• Resolved csburdick

    (@csburdick)


    Hello, this plugin is great but I have one problem. I’m trying to create some polls and only want to user to be able to vote once per poll. I can black based on cookie or IP but only for a certain number of days, if I change the poll I want them to be able to vote on that one, but only once per user (cookie or IP is fine.) I can do this only for logged in users (“Limit Number of Votes per User: (Only for logged users)”) How can I get it to only allow one vote per person per poll? Thank you!

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author YOP

    (@yourownprogrammer)

    Hi csburdick,

    Please tell us what version of YOP Poll you use.

    Regards,

    YOP Team

    Thread Starter csburdick

    (@csburdick)

    4.9.1

    Thanks

    Plugin Author YOP

    (@yourownprogrammer)

    Hey csburdick,

    Edit yop_poll_model.php and in register_vote function, after

    if ( 'facebook' == $vote_type ){
              $voter['user_id']   = $facebook_user_id;
              $voter['user_type'] = $vote_type;
             }

    add

    $ip     = self::get_ip();
                                        global $wpdb;
                                        $log_id = $wpdb->get_var( $wpdb->prepare( "
         SELECT count(*)
         FROM " . $wpdb->yop_poll_logs . "
         WHERE poll_id = %d AND
         ip = %s Group by  vote_date
         ", $this->poll['id'], $ip) );
                                        if($log_id>=1) {
                                            $this->error = __( 'You have run out of votes!', 'yop_poll' );
                                            return false;
    
                                        }

    Let us know if you need more help.

    Best wishes,

    YOP Team

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Can't choose only one vote per user per poll’ is closed to new replies.