Hello,

Anonymous vote rollover is not working except if it is set to "never".
If i set it to "1 day" anonymous users can vote as many times as they want.

Comments

mauritsl’s picture

I got the same issue when testing the Rate module for D7 (7.x-dev snapshot will be available within hours).

Just create a new widget (doesn't matter which type you choose), activate it on a nodetype and logout. You can vote as many times as you like. Expected result was that you changed your vote (like the D6 version does).

mauritsl’s picture

Status: Active » Needs review
StatusFileSize
new600 bytes

Problem seems to be that votingapi_select_votes() is not handling the timestamp criteria well. It only selects votes from that exact timestamp, instead of all votes from after that time. Patch attached fixed this issue for me.

Also note that the default value for this variable is not the same as on the settings page:

votingapi.module line 317:
$anon_window = variable_get('votingapi_anonymous_window', 3600);

votingapi.admin.inc line 19:
'#default_value' => variable_get('votingapi_anonymous_window', 86400),

This is also true for 6.x.

paranojik’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new1.47 KB

I can confirm the patch from #2 works. Without this fix, votingapi does not work as documented.
The attached patch also included the fix for the default value of 'votingapi_anonymous_window' to match the value from the settings page.

piferrari’s picture

thank you for this patch.
It works very well.

ambient.impact’s picture

Thanks for the patch.

Subscribing.

ericduran’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new559 bytes

I'm attaching a different patch.

Fixing the same problem, but this patch doesn't change the votingapi_anonymous_window and also remove the unnecessary is_array check.

zambrey’s picture

I cannot apply this patch to 7.x-2.x branch. I'm new to git so can you please tell me how can I use this patch?
I did following commands in Git Bash:

git clone --branch 7.x-2.x http://git.drupal.org/project/votingapi.git
cd votingapi
git apply -v votingapi-997092.patch

I have this patch in root directory of votingapi module and here is my output:

$ git apply -v votingapi-997092.patch
Checking patch votingapi.module...
error: while searching for:
  }
  $query = db_select('votingapi_vote')->fields('votingapi_vote');
  foreach ($criteria as $key => $value) {
    $query->condition($key, $value, is_array($value) ? 'IN' : '=');
  }
  if (!empty($limit)) {
    $query->range(0, $limit);

error: patch failed: votingapi.module:320
error: votingapi.module: patch does not apply
ericduran’s picture

The above patch was made from using the git diff --relative from my local checkout. I'll make a patch using the actual git.drupal.org repo and see if that fixes any problem.

ericduran’s picture

StatusFileSize
new626 bytes

Yeah, my votingapi version was out of date.

here's a second attempt.

zambrey’s picture

StatusFileSize
new1.07 KB

Thanks, now patch apply but it doesn't fix the problem.
I think change should be done in votingapi_votingapi_storage_select_votes() function rather than votingapi_select_results().

This one fixes the problem for me.

globexplorer’s picture

this patch worked fine for me. I hope that this issue will be fixed soon.

Taxoman’s picture

Anybody else that can confirm that the latest patch is working?

jg314’s picture

I tried to apply the latest patch and it failed to automatically patch. I was able to apply the patch from http://drupal.org/node/997092#comment-3940040 and it seems to be working. Does anyone know what the issue is with the latest patch?

zambrey’s picture

Latest patch is against 7.x-2.x-dev branch. Which version are you trying to patch?

jg314’s picture

I am trying to patch 7.x-2.4. Should I download the dev release? Is that stable?

zambrey’s picture

Well, I haven't got any problems so far with dev release.

jg314’s picture

Will the initial patch still work correctly on version 7.x-2.4?

zambrey’s picture

Patch looks good and it was approved by couple of people here. So it's your call since I don't know other issues that have been fixed in dev release.

sea4’s picture

the patch in #10 seems to be working so far. using the latest dev.

ksenzee’s picture

StatusFileSize
new1007 bytes

For those who don't want to move to the dev release, here's a rerolled version of #3 that applies cleanly to 7.x-2.4. The reroll fixes some whitespace and applies using patch -p1 or git apply. Drupal Gardens will likely be running this patch until the next release of Voting API.

nguyentran’s picture

Thanks, this working for me.

baby.hack’s picture

I'll confirm that #20 worked for me to fix the issue, although I didn't git apply. I just read the patch and made the listed changes manually.

brycesenz’s picture

confirming that the post in #20 works for me.

Taxoman’s picture

So how about committing this to the -dev branch?
Dev. hasnt been updated since April...

Juan C’s picture

It works. Thanks for the patch.

franzkewd’s picture

Status: Needs review » Reviewed & tested by the community
sa3er’s picture

Version: 7.x-2.x-dev » 7.x-2.4

This is a cirtical/security bug that could cause some kind of flood attack :)) if configured improperly and I don't know what are you dev guys are waiting for.

Thanks for the patch #20
It works great.

fenstrat’s picture

Version: 7.x-2.4 » 7.x-2.x-dev

The patch at #20 works well.

Would love to see a 2.5 release with this included.

ryan.ryan’s picture

Patch apploed - worked for me - time to roll out me thinks.

blogook’s picture

can someone pls upload a patched file #20 inhere? I have no clue how to patch this?

thanks in advance,

W/

blogook’s picture

no worries, problem solved

andypost’s picture

This tested near year for now, could someone ping maintainers to commit this?
#20 @ksenzee++

mauritsl’s picture

I already mailed the maintainer some time ago.. Still on it.

eaton’s picture

Status: Reviewed & tested by the community » Fixed

Committed with modifications, at long last. Sorry for the delay on this one. WIll be in the 2.5 release that I'm rolling up shortly.

andypost’s picture

Priority: Major » Critical
Status: Fixed » Needs work

Commit is totally wrong (diff) - there's no assignment now

eaton’s picture

Status: Needs work » Fixed

Let this be a lesson to you: "when you're doped up on prescription cold medicine but haven't fallen asleep yet" is rarely the right time to commit a bunch of patches. Proper patch committed now; thanks for the quick heads up.

Status: Fixed » Closed (fixed)

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