Download & Extend

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

Project:Vote Up/Down
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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,

Comments

#1

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

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

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

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

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

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

#7

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

#8

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

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

#10

Version:6.x-1.0-beta6» 6.x-1.x-dev

Works for me too. I created a patch (works for both 6.x-1.x-dev and 6.x.1.x-beta6).

AttachmentSizeStatusTest resultOperations
vote_up_down-anon.patch390 bytesIgnored: Check issue status.NoneNone

#11

Works for me too!

#12

Version:6.x-1.x-dev» 6.x-2.x-dev

#13

Version:6.x-2.x-dev» 6.x-1.x-dev

the patch works also for me

#14

Status:active» reviewed & tested by the community

#15

Status:reviewed & tested by the community» fixed

Committed, finally! Thanks!

#16

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

#17

subscribing

nobody click here