Closed (fixed)
Project:
Rate
Version:
7.x-1.5
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
11 Jun 2011 at 00:20 UTC
Updated:
18 Sep 2025 at 13:28 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
eliza411 commentedI'm seeking clarification: A user cannot cancel his or her vote in this or earlier versions?
Comment #2
ezra-g commented@eliza411, I believe that is correct.
Updating the issue title to clarify the feature requested here.
I'm working on a project that calls for this feature initially in the D6 version of Rate, but would likely need it in the D7 version eventually as well. I may be filing a patch ;).
Comment #3
tomogden commentedMy sites need this function as well. Good UI generally requires the user have a way to "undo" an action. There's currently no alternative to clicking a simple "Like" button. You can't take back that vote.
For Up/Down and Like widgets, the behavior seems simple: Clicking once sets the vote. Clicking again on the SAME button unsets the vote. Is that what you were thinking?
Good luck with this.
Comment #4
mmilo commentedThis can be done from the theme/module layer using hook_rate_vote_alter(), but the cache for the voting results won't be rebuilt.
Might want to follow #382866: provide script and documentation to rebuild the votingapi cache as well.
Comment #5
ezra-g commentedI marked #1520216: Missing Cancel option after Voting with thumbs up as a duplicate of this issue.
Comment #6
ezra-g commentedAdding the commonslove tag.
Comment #7
patrick.thurmond@gmail.comI am looking into getting this implemented. I am starting in the 7.x-1.x branch since the 2.x branch is not really functional yet.
Comment #8
ezra-g commentedIt seems like the 2.x branch is the active development branch, so I'd recommend going with that branch. Rate maintainers, feel free to let us know if that's not correct.
Comment #9
leschekfm commentedI did implement this in a custom module using hook_rate_vote_alter(). This worked flawlessly with rate-7.x-1.3 .
The snippet below alters the behavior of the rate widget to delete the previous given vote if you click on a rate button you had clicked anytime before.
Do note that this will probably cause problems with the Anonymous vote rollover, which we didn't need.
Comment #10
patrick.thurmond@gmail.comI have added the ability (per my attached patch) to undo/cancel a vote as requested in http://drupal.org/node/1185272. Specifically I added a widget specific feature that allows a second click on the same vote to undo the previously cast vote by that user.
So after applying this patch you need to go into the widget you are using. Then under "Interaction" the third question that shows up asks if the second click on a vote button should undo the previous vote. Some of the wording might feel awkward, but I think the intended functionality is clear.
Please let me know if there are any problems with it.
Comment #11
patrick.thurmond@gmail.comApparently the first patch file didn't generate properly due to an issue with viewing the repository with Git Tower while using the command line to make the patch. Here is the patch file with content.
Comment #12
mauritsl commentedLooks good, thanks! I will test this patch soon and commit if everything works fine.
Not sure why this part is needed, though..
Comment #13
mauritsl commentedCommitted to 7.x. Thanks!
I've added an update hook to add the "delete_vote_on_second_click" property to existing widgets.
Comment #14
mauritsl commentedComment #16
grn commentedHi, in wich version is this implemented?
It does not seem to work for me in 7.x-1.5. I use the vote up widget, counting the votes.
Thanks.
Comment #17
grn commentedSorry, it was a setting in the settings on the rate widget.
BR. GrN.dk
Comment #18
mauritsl commentedComment #19
ivnish