WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. fgrosjean
    Member
    Posted 1 year 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,

    http://wordpress.org/extend/plugins/yop-poll/

  2. YOP
    Member
    Plugin Author

    Posted 1 year 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
    FROM

    Also, before return $log_id; add

    if ($log_id <= 4 )
    return false;

    In the end you should have

    $log_id = $wpdb->get_var(
    $wpdb->prepare(
    "
    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.")
    ",
    $this->poll['id'],
    $ip,
    $value
    )
    );

    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

Tags

No tags yet.