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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

matt@antinomia’s picture

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.

kirie’s picture

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

quotesBro’s picture

Priority: Minor » Normal
Status: Needs review » Reviewed & tested by the community
quotesBro’s picture

This patch work for 5.x.

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

lut4rp’s picture

Status: Reviewed & tested by the community » Fixed

Fixed!

lut4rp’s picture

Status: Fixed » Needs work

err, wrong fix. Sorry :-/

quotesBro’s picture

Version: 5.x-1.x-dev » 6.x-1.0-beta6
Status: Needs work » Needs review
FileSize
2.43 KB

patch for 6.x-1.0

ingo86’s picture

Assigned: Unassigned » ingo86

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

quotesBro’s picture

FileSize
3.23 KB

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

marvil07’s picture

Status: Needs review » Fixed
FileSize
3.11 KB
3.78 KB

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.

Status: Fixed » Closed (fixed)

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