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,

CommentFileSizeAuthor
#10 vote_up_down-anon.patch390 bytesjumpfightgo
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lut4rp’s picture

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 :-)

Mark_J’s picture

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,

batbug2’s picture

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!

batbug2’s picture

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.

batbug2’s picture

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

    // 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.

lyricnz’s picture

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

greggus-1’s picture

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

Clint Eagar’s picture

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.

pfaffman’s picture

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

jumpfightgo’s picture

Version: 6.x-1.0-beta6 » 6.x-1.x-dev
FileSize
390 bytes

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

CarbonPig’s picture

Works for me too!

tobiasb’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev
tobiasb’s picture

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

the patch works also for me

jcisio’s picture

Status: Active » Reviewed & tested by the community
lut4rp’s picture

Status: Reviewed & tested by the community » Fixed

Committed, finally! Thanks!

Status: Fixed » Closed (fixed)

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

lubnax’s picture

subscribing