WordPress.org

Ready to get started?Download WordPress

Forums

Vote It Up
Allow Multiple Votes? (2 posts)

  1. ia
    Member
    Posted 2 years ago #

    I'm using version 1.2.2 so I'm not sure this code applies. Any insight?

    //Checks if the user voted
    function UserVoted($post_ID, $user_ID) {
    	global $wpdb;
    
    	//prevents SQL injection
    	$p_ID = $wpdb->escape($post_ID);
    	$u_ID = $wpdb->escape($user_ID);
    
    	//Create entry if not existant
    	SetPost($p_ID);
    
    	//Gets the votes
    	$votes_raw = $wpdb->get_var("SELECT votes FROM ".$wpdb->prefix."votes WHERE post='".$p_ID."'");
    	$sinks_raw = $wpdb->get_var("SELECT usersinks FROM ".$wpdb->prefix."votes WHERE post='".$p_ID."'");
    
    	//Put it in array form
    	$votes = explode(",", $votes_raw);
    	$sinks = explode(",", $sinks_raw);
    
    	$voted = FALSE;
    	$votekey = array_search($u_ID, $votes);
    	$sinkkey = array_search($u_ID, $sinks);
    	if ($votekey != '' | $sinkkey != '') {
    		$voted = TRUE;
    	}
    	return $voted;
    }

    Is it also possible to allow users to vote for multiple posts but disallow multiple voting on a single post?

    http://wordpress.org/extend/plugins/vote-it-up/

  2. GuerillaDesigns
    Member
    Posted 1 year ago #

    I am having some issues with vote counting on my site, voteitup says that I've voted on something that I haven't. Could this be fixed in a similar way?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags