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?