Hi, have installed plus1 7.x.-1.x

gr8 module btw!

But having problems with guest's voting.. the button is showing up but noting happens when clicked.

// TB

CommentFileSizeAuthor
#8 enable-anon-voting-1217670-7.patch1.2 KBguldi
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gabidrg’s picture

The issue comes from several drupal_valid_token() function calls in plus1.module, for anonymous users a third parameter has to be supplied aka $skip_anonymous = TRUE, see below:

function plus1_vote($entity_type, $entity_id, $tag = 'plus1_node_vote') {
  global $user;
  if (!drupal_valid_token($_GET['token'], $entity_id, $skip_anonymous = TRUE)) {
    watchdog('plus1', 'Voting form error: Invalid token.');
    return drupal_access_denied();
  }
Dimmduh’s picture

Also for next function - plus1_undo_vote:

function plus1_undo_vote($entity_type, $entity_id, $tag = 'plus1_node_vote') {
  global $user;
  if (!drupal_valid_token($_GET['token'], $entity_id, $skip_anonymous = TRUE)) {
    watchdog('plus1', 'Voting form error: Invalid token.');
    return drupal_access_denied();
  }
  ...
falbertin’s picture

Great idea, but flawed: After implementing the above change, anonymous users can vote as many times as they want. Not the intent of the module, I think. ;)

Would there be a way of preventing double voting? Thanks!

Steven Jones’s picture

Plus1 would need to leverage the http://drupal.org/project/session_api module I think.

guldi’s picture

I need this module and the bug must be fixed.
I don't think session_api is needed here.

Getting back when I'm done.

guldi’s picture

Assigned: Unassigned » guldi
guldi’s picture

Assigned: guldi » Unassigned
Status: Active » Needs review

Ok, for what I see, #1 and #2 would do the trick. If you want to prevent guests from excessive voting, you have to configure the voting-api (admin/config/search/votingapi) with the option "Anonymous vote rollover".
When set to 'never', your guest won't be able to revote from the same ip-address. If you choose '15 minutes', the guest will be able to revote for the same content after 15 minutes.

I suggest the maintainers of the module to commit the two changes suggested in comment #1 and #2.

guldi’s picture

Assigned: Unassigned » guldi
FileSize
1.2 KB

Here's the patch for my suggestion #7.

rowbeast’s picture

Just tested out the patch in #8 and agree with #3, anon voters can now vote, however it does not respect the value settings from Voting API. Anon voters can vote unlimited times immediately. Renders the patch useless sadly. Happy to test any further patches as well.

davident’s picture

Priority: Normal » Major
Status: Needs review » Needs work

Confirming the above vote breaks time based vote rollover rules in the Voting API, essentially making it a non-starter.
Anyone have a fix yet? It appears the maintainer isn't active.

davident’s picture

I have found a fix to this problem. The following will allow anonymous voting with timed rollover.

1.) Apply the patch in this thread that turns on anonymous voting (#7)
2.) Apply the patch following patch to VotingAPI http://drupal.org/node/997092#comment-4867370

The problem seems to lie in both modules, not just Plus1.

amitavroy’s picture

The module is nice but the only issue is the same not able to vote as anonymous user and I guess that is the reason the vote was set before any check of whether a vote is already set or not.

Waiting for the functionality :)
I was trying that on one of my modules which I have not posted here but on my site http://www.amitavroy.com/justread/content/articles/ajax-and-dislike-usin... but I am not able to check for the IP.

rogical’s picture

Status: Needs work » Reviewed & tested by the community

Voting api is supporting anonymous well now, patch at #8 works fine.

This patch is going to be committed if no more issue.

rogical’s picture

Status: Reviewed & tested by the community » Fixed

Committed

Status: Fixed » Closed (fixed)

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

kladix’s picture

Solution #7 works! Thanks a lot!