Posted by greggles on June 11, 2009 at 11:45pm
Jump to:
| Project: | Plus 1 |
| Version: | 7.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | NancyDru |
| Status: | closed (fixed) |
Issue Summary
Currently when a user is logged out they may see a link like
<a href="/user">
Log in
<br/>
to vote
</a>It would be nice if it went to
<a href="/user?destination=path/to/current/page">
Log in
<br/>
to vote
</a>
Comments
#1
Try this:
--- plus1.module 2009-03-18 06:04:42.000000000 +0100+++ plus1.module 2010-02-02 19:10:03.000000000 +0100
@@ -296,7 +296,7 @@
if (!$logged_in || user_access('vote on content')) {
$output .= '<div class="'. $message_class . '">';
if (!$logged_in && !user_access('vote on content')) {
- $output .= '<small>'. l(t('Log in<br />to vote'), 'user', array('html' => TRUE)) .'</small>';
+ $output .= '<small>'. l(t('Log in<br />to vote'), 'user', array('query' => 'destination=node/' . $node->nid, 'html' => TRUE)) .'</small>';
}
else if ($voted) { // User already voted.
$output .= check_plain(variable_get('plus1_you_voted', t('You voted')));
#2
That only works if you are currently on a full node view. what if a user is looking at a list of teasers?
#3
This will be fixed when I commit.
#4
Committed to 6.x-2.x-dev.
#5
Automatically closed -- issue fixed for 2 weeks with no activity.
#6
I don't think this code is in the 7.x version.
Ideally, when a user clicks on Vote, and they need to login/register first.
After they login via what ever means, their vote will be counted and they'll be redirected back to the page where they initiated the vote.
I think that's most likely the best UX.