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.
1. The login div is shown at the bottom for logged user. I changed it so footer is returned only for anonymous user.
2. My "user/login" link has destination query string to send the user back to the original page where they click the login link. I change the javascript to be compatible with this use case. It should work the same as before.
you can see this working at http://zen.hddigitalworks.com/node/198, click the login link at the upper right, use user name "visitor", passoword "123". After login, you should be back to that page instead of going the /user.
Thanks for the module.
Comment | File | Size | Author |
---|---|---|---|
fancy_login.patch | 1.53 KB | mattyoung |
Comments
Comment #1
mattyoung CreditAttribution: mattyoung commentedBTW, it works fine in 'user/password' and 'user/register' paths.
Try login from http://zen.hddigitalworks.com/user/password or http://zen.hddigitalworks.com/user/register
Comment #2
Jaypan CreditAttribution: Jaypan commentedThanks for taking care of this! Much appreciated.
I'm going to create an administration page that lets the user decide whether they want to be forwarded to the site's front page after login, or if they want to stay on the page they are on. So can you give me a quick run down on what this means:
I was looking at it, and didn't really get what you have done there. Thanks.
Comment #3
mattyoung CreditAttribution: mattyoung commented>I'm going to create an administration page that lets the user decide whether they want to be forwarded to the site's front page after login
No, don't do that. You should just leave that decision to whoever created the 'user/login' link to decide. And this is what my patch accomplish. Let me explain how this works.
This looks for any <a> tag with href attribute *begins with* 'user/login' (note that ^= instead of =). This will match href like 'user/login?destination=<front>'. (I'll explain what this does later).
Inside the click event handler:
this replace the fancy_login form's action url with the <a> tag href the user click on.
With this, fancy_login does not need to care about where to send the user to after login anymore. That decision is with the <a> tag login link. Those links can be like:
'user/login?destination=node/12345' this will send the user back to the node page 12345 after login
'user/login?destination=<front>' this will send the user to the front page after login
'user/login' this will go to the user page
Where is no way you can cover every case and you shouldn't. With my patch, people are free to do whatever they want with their login link and fancy_login will adapt to it.
Try it at my test site http://zen.hddigitalworks.com, user 'visitor', password '123'
Click on any link on that page, then click login at the upper right, you will see the page come back to the same place after login. You don't need to change fancy_login anymore.
If people ask you about sending them to the front page or where ever else, just tell them to set the destination query string in their login link. This is how they should do it without fancy_login and it shouldn't be any different with fancy_login.
Comment #4
Jaypan CreditAttribution: Jaypan commentedNice, thanks for the explanation, I got it. I'll commit it today!
Comment #5
Jaypan CreditAttribution: Jaypan commentedEdit: Realized the post contents didn't work at all.
Comment #6
Jaypan CreditAttribution: Jaypan commentedNew code applied in beta4
Comment #7
Jaypan CreditAttribution: Jaypan commented