It casts multiple votes - same IP | latest version - I voted 20 times! :) :)

Mark_J - January 20, 2009 - 01:18
Project:Vote Up/Down
Version:6.x-1.0-beta6
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:active
Description

Hi there,

I read the previous topic before and I believe you believe the issues has been resolved.

However, I have enabled anonymous voting and the anonymous user can vote as many times as they want. I voted 20+ votes.

I am using votingapi-6.x-2.0-rc2.tar.gz and vote_up_down-6.x-1.0-beta2.tar.gz

Also, is it possible to align the vote up/down next to "Read More" or next to "Add Comment?" line? Also rather than having the down arrow under the up arrow, it would be nice if we can put them together on one line so it will look something like this:

Vote Up Vote Down Add Comment Vote Points where Vote Up and Vote Down are the images for vote up and down.

I suspect the code that handles this is written in the module file so I will have find the section and modify it. Any hints will be welcome.

Cheers,

#1

lut4rp - January 20, 2009 - 07:17

This issue has been fixed in the dev version. Thanks!
edit: rather, I think I should release beta3 with the fixes, and the latest SimpleTest files :-)

#2

Mark_J - January 20, 2009 - 07:33

hey thanks for that,

Is it possible to shed some light on the second question please? :) :)

I can try my luck by opening another issue?

Cheers,

#3

batbug2 - January 29, 2009 - 11:04
Priority:normal» critical

Tried beta2 and -dev -- issue is there - anonymous user can vote as many times as they want!
Had to roll back to beta1, there is no bug there! Fix this ASAP please!

#4

batbug2 - January 29, 2009 - 11:08

And more info: if i put the vote_up_down.module file from the beta1 to the -dev pack, issue goes away, so I'd say the problem is somewhere in the vote_up_down.module file.

#5

batbug2 - January 29, 2009 - 11:44

Ok, I have tracked down the issue: the problem is in the vote_up_down_vote() function, here

<?php
   
// Do the voting via Voting API.
   
if ($uid = _vote_up_down_get_uid()) {
      if (
$vote['value'] == 0) {
       
$criteria = array('content_type' => $type, 'content_id' => $cid, 'uid' => $uid, 'tag' => $tag);
       
votingapi_delete_votes(votingapi_select_votes($criteria));
       
votingapi_recalculate_results($type, $cid);
      }
      else {
       
$vote['content_id'] = $cid;
       
$vote['content_type'] = $type;
       
$vote['uid'] = $uid;
       
$votes = array(0 => $vote);
       
votingapi_set_votes($votes);
      }
    }
?>

the error is here
$vote['uid'] = $uid;

In this case $uid for anonymous users is derived from the ip address in the vote_up_down module itself.
Though VotingAPI has its own way of detection of anonymous votes, and $vote['uid'] is optional.

If I comment out this line, anonymous users won't be able to vote multiple times on the same node. Hope this helps.

#6

lyricnz - January 30, 2009 - 09:02

Yes, I think Vote Up/Down should not be dealing with uid at all here - it should be left to Voting API.

#7

greggus - March 6, 2009 - 13:21

I confirm.
Commenting out this line fixes wrong uid for anonymous users problem.

#8

Clint Eagar - October 14, 2009 - 17:10
Version:6.x-1.0-beta2» 6.x-1.0-beta6

This problem exists in beta6 as well. I confirm that commenting out: $vote['uid'] = $uid; does the trick.

#9

pfaffman - November 5, 2009 - 21:36

Me too. Comment out 561 to disallow multiple anon votes.

 
 

Drupal is a registered trademark of Dries Buytaert.