function plus1_vote doesn`t pass arg vote_source to voteAPI.
Problem: If anonymous user do "vote undo" and ip address of anonymous and registred user are equals then votes of this node will reset.
you should pass vote_source to voteAPI:
'vote_source' => $user->uid ? $user->uid : ip_address(),
all code:
function plus1_vote($entity_type, $entity_id, $tag = 'plus1_node_vote') {
global $user;
if (!drupal_valid_token($_GET['token'], $entity_id, $skip_anonymous = TRUE)) {
watchdog('plus1', 'Voting form error: Invalid token.');
return drupal_access_denied();
}
$voted = plus1_get_votes($entity_type, $entity_id, $user->uid, $tag);
//print_r( $voted );
// If the voter has not already voted.
if (!$voted) {
$votes[] = array(
'entity_type' => $entity_type,
'entity_id' => $entity_id,
'value_type' => 'points',
'value' => 1,
'tag' => $tag ? $tag : 'plus1_' . $entity_type . '_vote',
'vote_source' => $user->uid ? $user->uid : ip_address(),
);
Comments
Comment #1
rogical commentedI created a patch for this
Comment #2
shopobdii commentedIt is very useful, thanks for your sharing! I am looking forward to your update.
Comment #3
rogical commentedCommitted.
Comment #4
nancydruShaun, when you fix an issue, mark it "fixed" so that it stays visible for another two weeks.
Comment #5
rogical commentedOkay, got it.