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.
…instead of to the node page - though if someone votes from that page, it will still work. I'm using Plus1 in a case where I'm using a view to list several nodes on one page, from which users can vote, and we want them to go back to that same view page, not to the node's page.
Comment | File | Size | Author |
---|---|---|---|
plus1-referer.patch | 466 bytes | Garrett Albright |
Comments
Comment #1
NancyDruLooks good to me.
Comment #2
voxpelli CreditAttribution: voxpelli commentedA fallback is needed if the referer isn't set since we can't rely on the referer always being there?
Comment #3
NancyDruJust a thought: How about something like
Shouldn't that work in all cases?
Comment #4
NancyDruActually, my suggestion does not work because the button goes to /plus1/vote. However, would that not ensure that a referer is set?
Comment #5
voxpelli CreditAttribution: voxpelli commentedI don't think referers can be relied on - why not use Drupal's destination system instead?
Comment #6
NancyDruHow about
and
I'm not sure, but I think the query string should use drupal_urlencode().
Comment #7
voxpelli CreditAttribution: voxpelli commentedThe drupal_goto('node/'. $nid) doesn't need to be changed - we only need to add the destination to the url. We could do that as an extension of the patch in #322735: Vote link is executed by search engines?
Comment #8
NancyDruToo fast; we cross-posted.
Comment #9
NancyDruComment #10
NancyDruCommitted to 6.x-2.x-dev.