WordPress.org

Forums

YOP Poll
[resolved] Block Users By 1 Day Doesn't Work (4 posts)

  1. Chuck
    Member
    Posted 1 year ago #

    Hi,

    We are having some users complain that they cannot vote after they voted yesterday.

    Our settings are currently set to Block Voters by Cookie and 1 day. Shouldn't this reset at midnight every day?

    Thanks for your help,

    https://wordpress.org/plugins/yop-poll/

  2. YOP
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Chuck,

    With those settings it will reset after 24 hours.

    If some one votes right now then he will be able to vote again at exactly the same time, tomorrow.

    Best wishes,

    YOP Team

  3. Chuck
    Member
    Posted 1 year ago #

    So how do we get it to restart at midnight? It seems like your 1 day option comes down to choosing 24 hours?

  4. YOP
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Chuck,

    Sorry it took so long to get back to you.

    Please edit inc/yop_poll_model.php and in set_vote_cookie function (located approximately on line 3813) in case 'days': replace

    $expire_cookie = time() + ( 60 * 60 * 24 * $value );
                            break;

    with

    if( $value == 1 ) {
                            $expire_cookie = mktime(0, 0, 0, date('n'), date('j') + 1);
                            break;
                        }
                        else{
                            $expire_cookie = time() + ( 60 * 60 * 24 * $value );
                            break;
                        }

    By making these changes the cookies will expire at 00:00:00, the browser will no longer send them and the user will be able to vote again after midnight.

    This will work only if you set Blocking Voters : by Cookie.

    Regards,

    YOP Team

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic