Active
Project:
Login Destination
Version:
6.x-2.12
Component:
User interface
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
12 Jan 2013 at 19:15 UTC
Updated:
14 Jan 2013 at 22:16 UTC
I need to have 2 destinations. One for first-time login and password reset and another for all other times.
This is a simple use case but I'm having the hardest time getting it right. Maybe it's because I have both Login Destination and Login Toboggan and the fact that I have both the login block and the registration forms on the homepage. I've tried so many things - enable, disable, preserve, rules, and settings every which way.
Can I do this with just this module using php in the Redirection conditions and/or Destination URL settings?
Does anyone have php handy for this you can share where all I need to do is add the paths?
Comments
Comment #1
hjulien commentedI solved this.
This is what was happening when the user copied and pasted the temporary password into the already open homepage instead of using the link:
1.They'd stay on the homepage where there was no navigation and nothing but the registration form and the login block and a bit of text about the site.
What I did first:
Created a rule that sent them to the user/me/edit page (same as the user/%uid/edit ).
The rule checks a truth value and this is the php code:
return (user_stats_get_stats('login_count', $account->uid) == 1) ? ’1′ : ”;
The action is a redirect. This requires the user_stats module and will work for the first-time login.
Result:
Now the user was going to the right page. However, the system added a destination to the end of the link and was sending the user back to the homepage after the password was changed. Again, a homepage that goes nowhere....
What I did next:
Used login destination to force anytime the user goes to homepage to be re-routed to an internal dashboard page.
Next issue:
It seems the code was sending to the user to the user/me/edit page every time they logged in. Yikes! They'll think they need to keep changing their password or something...
What I did next:
I created a rule with a re-direct to the internal homepage on all subsequent logins. Here's the condition using custom php:
If ([account:user-last-login-raw]) {
return TRUE;
}
else {
return FALSE;
}
That's it.
All I have to add is that whenever you test the login process on your site, make sure you test all 3 ways of logging in from the email users are sent. I hope this helps others!