WordPress.org

Forums

YOP Poll
[resolved] Limit the votes in all polls on the website (4 posts)

  1. Looup
    Member
    Posted 1 year ago #

    Hi,
    I have many polls on my website but I want to limit the user's vote to only one poll. It's possible that the user can only vote one poll and block the others?

    Thanks for the help!

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

  2. Looup
    Member
    Posted 1 year ago #

    This could be useful: if all the polls are limited by username, in is_voted_username method (line 4291) change this:

    "
    SELECT id
    FROM ".$wpdb->yop_poll_logs."
    WHERE poll_id = %d AND
    user_id = %d AND
    vote_date >= DATE_ADD( %s, INTERVAL -%d ".$unit.")
    ",
    $this->poll['id'],
    $user_id,
    current_time( 'mysql' ),
    $value

    to this:

    "
    SELECT id
    FROM ".$wpdb->yop_poll_logs."
    WHERE
    user_id = %d AND
    vote_date >= DATE_ADD( %s, INTERVAL -%d ".$unit.")
    ",
    $user_id,
    current_time( 'mysql' ),
    $value

    Could be a hardcoded solution??

  3. YOP
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Looup,

    Yes, your solution is good but please note that it will work only for logged users.

    Regards,

    YOP Team

  4. Looup
    Member
    Posted 1 year ago #

    Yes, it works fine.
    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags