Hi,
- I installed vud_node and added a vud-widget to a node view.
- I voted for some nodes at the view page. Everything worked well. The total counts changed by the AJAX requests.
- I went to another page.
- I used the browser back button of Firefox 16.0.2.
Back on the view page:
- The orginal counter values have been shown, not the ones after my votes. This propably is caused by browser cache.
A confused user now might try to vote again, since he believes, that something went wrong.
If you do so and use the same voting links as the first time, there is a terrible error message from the AJAX call (without any error description):
"An error occurred at /sandpit/vote/node/533/1/vote_updown/alternate/3d3e4b3067063404ff6dd42e4f804e9f.
Error Description:"
The reason is the following part in vud_vote():
// Do not allow to vote with the same value.
if ($casted_vote == $votes[0]['value']) {
return;
}
votingapi_set_votes($votes);
A simple fix with an intuitive behaviour:
// Do not allow to vote with the same value.
if ($casted_vote != $votes[0]['value']) {
votingapi_set_votes($votes);
}
Now there is no error message anymore, the double voting request is ignored in counting and the widget is themed as the user expects it.
Comments
Comment #1
elshae commentedThank you for posting this as I am having the same issue. However, adding your fix now only consider one anonymous vote for me. In other words, if an anonymous user votes and then if another anonymous user tries, they see it as if they have already voted. I have tried this on both Chrome and Safari.
Comment #2
marvil07 commentedClosing D6 issues, D6 releases are not supported now.
Please reopen as D7 if needed.