Vote It Up
Allow Multiple Votes? (2 posts)

  1. ia
    Posted 4 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
    	//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?


  2. GuerillaDesigns
    Posted 4 years 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

  • Vote It Up
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic