| 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
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
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
Works for me too. I created a patch (works for both 6.x-1.x-dev and 6.x.1.x-beta6).
#11
Works for me too!
#12
#13
the patch works also for me
#14
#15
Committed, finally! Thanks!
#16
Automatically closed -- issue fixed for 2 weeks with no activity.
#17
subscribing