Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#10 | only-show-reset-if-voted-1.x.patch | 3.78 KB | marvil07 |
#10 | only-show-reset-if-voted-2.x-3.x.patch | 3.11 KB | marvil07 |
#9 | vote_up_down.module.patch | 3.23 KB | quotesBro |
#7 | vote_up_down.module.patch | 2.43 KB | quotesBro |
#1 | vote_up_down_reset_link.patch | 1.78 KB | matt@antinomia |
Comments
Comment #1
matt@antinomia CreditAttribution: matt@antinomia commentedRerolled against -dev. Also cleaned up patch, removing vote_up_down_hasvoted() in favor of VotingAPI's votingapi_get_user_votes() which does the same.
Comment #2
kirie CreditAttribution: kirie commentedInstead of having the 'Reset vote' link, would it be better to allow resetting a vote (if present) through the voting vidget?
Comment #3
quotesBro CreditAttribution: quotesBro commentedComment #4
quotesBro CreditAttribution: quotesBro commentedThis patch work for 5.x.
It is necessary for version 6.x too but in 6.x other functions
Comment #5
lut4rp CreditAttribution: lut4rp commentedFixed!
Comment #6
lut4rp CreditAttribution: lut4rp commentederr, wrong fix. Sorry :-/
Comment #7
quotesBro CreditAttribution: quotesBro commentedpatch for 6.x-1.0
Comment #8
ingo86 CreditAttribution: ingo86 commentedWill look to add this patch asap. Stay tuned for beta7.
Comment #9
quotesBro CreditAttribution: quotesBro commentedPlease don't use patch #7
here is a better variant
Comment #10
marvil07 CreditAttribution: marvil07 commentedI made three changes:
- Since #544962: use votingapi for uid criteria, there is no more
_vote_up_down_get_uid()
, in favour ofvotingapi_current_user_identifier()
- Fix data member for comment, cid instead of nid.
- Use explicitly
is_null()
at the conditionalThen, I commited this to 1.x, port this to 2.x/3.x and commit it also to 2.x/3.x.