YOP Poll
[resolved] Multiple votes per cookie (2 posts)

  1. fgrosjean
    Posted 3 years ago #

    I would like to allow multiple votes per cookie or ip ie. 4 votes and then block the user, don't know if that's possible via the front end of the plugin but if you could explain how to do that by modifying some core file that would be appreciated, thanks,


  2. YOP
    Plugin Author

    Posted 3 years ago #

    Hi fgrosjean,

    You can not allow multiple votes per cookie but we can provide a fix that will allow multiple votes per IP.

    Go to yop_poll_model.php and in this function, private function is_voted_ip() {, look for

    SELECT id
    FROM ...

    replace this with

    SELECT count( *) as votes

    Also, before return $log_id; add

    if ($log_id <= 4 )
    return false;

    In the end you should have

    $log_id = $wpdb->get_var(
    SELECT count( *) as votes
    FROM ".$wpdb->yop_poll_logs."
    WHERE poll_id = %d AND
    ip = %s AND
    vote_date >= DATE_ADD( NOW(), INTERVAL -%d ".$unit.")

    if ($log_id <= 4 )
    return false;
    return $log_id;

    For all this to work, edit your poll and in "Other Options" choose "Blocking Voters: " - "By Ip" and save.

    Best wishes,

    YOP team

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic


No tags yet.