Display poll results after voting for anonymous users
chrism2671 - October 13, 2008 - 16:44
| Project: | Advanced Poll |
| Version: | 5.x-1.0-beta6 |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | postponed (maintainer needs more info) |
Jump to:
Description
Which permission does this? I couldn't get it to work,although I'm sure it's trivial.
Thanks,
Chris.

#1
I'm interested in figuring this out, too. No luck so far...
#2
Still not got a solution for this. If anybody does, please let me know!
#3
Check this thread in VotingAPI issues: http://drupal.org/node/108341
After applying the patch in I got rid of this problem:
http://drupal.org/node/108341#comment-819121
The patch doesn't seems not to be included in latest available VotingAPI 5.x-1.6 release.
However, now I'm getting error message from advpoll/modes/binary.inc during vote cancel, if anonymous users are allowed to cancel their voters.
#4
Please don't say you're getting an error message without reporting what the message is. How does that help anyone?
#5
I'm having the same problem with 6.x (but don't see any error messages, sadly :)
#6
Sorry about that, I didn't have enough time to check this in details until now. When using the patched VotingAPI as described in #3 in order to allow anonymous users to vote (and also because my host is behind reverse proxy) I'm getting following error message when anonymous user tries to cancel the vote, and the vote is not deleted from the database:
warning: Invalid argument supplied for foreach() in /sites/all/modules/advpoll/modes/binary.inc on line 315.
The patched VotingAPI module uses
$_SERVER['REMOTE_ADDR'].'-'.$_SERVER['HTTP_X_FORWARDED_FOR']for the hostname for anonymous users, while in function advpoll_cancel only HTTP_X_FORWARDED_FOR is used. That probably explains why the vote doesn't get deleted from votingapi table in database, because the hostnames don't match.
EDIT:
I quickly fixed these by changing in file advpoll.module function advpoll_cancel, line 1345
$host = $_SERVER['HTTP_X_FORWARDED_FOR']? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];to:
$host = $_SERVER['REMOTE_ADDR'] . ($_SERVER['HTTP_X_FORWARDED_FOR'] ? '-'. $_SERVER['HTTP_X_FORWARDED_FOR'] : '');And replaced line 1341
if ($user->uid && count($user_vote = votingapi_get_user_votes('advpoll', $node->nid)) > 0) {with:
$user_vote = votingapi_get_user_votes('advpoll', $node->nid);if ($user->uid && count($user_vote) > 0) {
I think the $user_vote was not set anymore after the if-else block, when it was used. It seems that these modifications cleared the error message & anonymous cancel problem. Unfortunately I'm unable to produce a patch file for these right now.
However, I think that there may be an issue with the patched VotingAPI, since the patch does not address the problem with function votingapi_get_user_votes (which also advpoll_cancel calls), which will return all votes where userid 0, not checking the hostname.