Patch to let Special:UserLogout pass returnto parameters to Special:UserLogin
After a user has logged out and logged back in, it would be nice if the "return to" link on the login success page pointed to the page the user was on before logging out (rather than to the Main Page).
Steps to reproduce:
- Go to any page on the wiki (other than the Main Page).
- Click the "log out" link from the personal toolbar.
- Observe the convenient "return to" link back to the page you came from at the bottom of the page, but don't click it. Instead, click the "log in again" link shown earlier on the page.
- Log in.
- Observe that the "return to" link on the page you see now is much less convenient, since it always points to the Main Page.
This would actually seem quite easy to fix: Special:UserLogout just needs to pass any "returnto" (and "returntoquery") parameters it receives to Special:UserLogin. This needs some technical fiddling with messages, since the existing "log in again" link is just an ordinary wikilink in the logouttext message, but it's not really very difficult.
In fact, I wrote the code to fix this (see attached patch) and tested it, but hit upon a snag: if Special:UserLogin receives a "returnto" parameter (and if no extensions like CentralAuth interfere) it will not show a success page at all, but will just redirect directly to the given page. This seems to be a deliberate feature, and is probably useful if you're coming from a page that told you to log in first, but in this case it seems quite unexpected and probably undesirable.
So, instead of committing this, I'll just dump the diff here and ask what others think. Would this be a useful feature at all? If so, exactly how should it work?