Download & Extend

Anonymous vote rollover not working

Project:Voting API
Version:7.x-2.x-dev
Component:Miscellaneous
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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

#1

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

#2

Status:active» needs review

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.

AttachmentSize
votingapi_997092.patch 600 bytes

#3

Status:needs review» reviewed & tested by the community

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.

AttachmentSize
votingapi-997092-3.patch 1.47 KB

#4

thank you for this patch.
It works very well.

#5

Thanks for the patch.

Subscribing.

#6

Status:reviewed & tested by the community» needs review

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.

AttachmentSize
votingapi-997092.patch 559 bytes

#7

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

#8

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.

#9

Yeah, my votingapi version was out of date.

here's a second attempt.

AttachmentSize
votingapi-997092-2.patch 626 bytes

#10

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.

AttachmentSize
votingapi-997092-10.patch 1.07 KB

#11

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

#12

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

#13

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?

#14

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

#15

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

#16

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

#17

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

#18

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.

#19

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

#20

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.

AttachmentSize
997092-20.votingapi-anonymous-votes.patch 1007 bytes

#21

Thanks, this working for me.

#22

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.

#23

confirming that the post in #20 works for me.

#24

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

#25

It works. Thanks for the patch.

#26

Status:needs review» reviewed & tested by the community

#27

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.

#28

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.

#29

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

#30

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

thanks in advance,

W/

#31

no worries, problem solved

#32

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

#33

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

#34

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.

#35

Priority:major» critical
Status:fixed» needs work

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

#36

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.

#37

Status:fixed» closed (fixed)

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

nobody click here