Download & Extend

Only show 'Reset vote' link if user has voted on node/comment

Project:Vote Up/Down
Version:6.x-1.0-beta6
Component:Code
Category:bug report
Priority:normal
Assigned:ingo86
Status:closed (fixed)

Issue Summary

This patch creates a helper function vote_up_down_hasvoted() to check if the user has already voted on a node/comment. If not, it hides the 'Reset vote' link.

AttachmentSizeStatusTest resultOperations
vote_up_down_reset_link.patch8.47 KBIgnored: Check issue status.NoneNone

Comments

#1

Rerolled against -dev. Also cleaned up patch, removing vote_up_down_hasvoted() in favor of VotingAPI's votingapi_get_user_votes() which does the same.

AttachmentSizeStatusTest resultOperations
vote_up_down_reset_link.patch1.78 KBIgnored: Check issue status.NoneNone

#2

Instead of having the 'Reset vote' link, would it be better to allow resetting a vote (if present) through the voting vidget?

#3

Priority:minor» normal
Status:needs review» reviewed & tested by the community

#4

This patch work for 5.x.

It is necessary for version 6.x too but in 6.x other functions

#5

Status:reviewed & tested by the community» fixed

Fixed!

#6

Status:fixed» needs work

err, wrong fix. Sorry :-/

#7

Version:5.x-1.x-dev» 6.x-1.0-beta6
Status:needs work» needs review

patch for 6.x-1.0

AttachmentSizeStatusTest resultOperations
vote_up_down.module.patch2.43 KBIgnored: Check issue status.NoneNone

#8

Assigned to:Anonymous» ingo86

Will look to add this patch asap. Stay tuned for beta7.

#9

Please don't use patch #7
here is a better variant

AttachmentSizeStatusTest resultOperations
vote_up_down.module.patch3.23 KBIgnored: Check issue status.NoneNone

#10

Status:needs review» fixed

I made three changes:

- Since #544962: use votingapi for uid criteria, there is no more _vote_up_down_get_uid(), in favour of votingapi_current_user_identifier()
- Fix data member for comment, cid instead of nid.
- Use explicitly is_null() at the conditional

Then, I commited this to 1.x, port this to 2.x/3.x and commit it also to 2.x/3.x.

AttachmentSizeStatusTest resultOperations
only-show-reset-if-voted-1.x.patch3.78 KBIgnored: Check issue status.NoneNone
only-show-reset-if-voted-2.x-3.x.patch3.11 KBIgnored: Check issue status.NoneNone

#11

Status:fixed» closed (fixed)

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