Hello,
I have a private Wiki, in which access to any page requires authentication. I did that by using this configuration (as suggested in http://www.mediawiki.org/wiki/Manual:Preventing_access):
$wgGroupPermissions['*']['read'] = false; $wgGroupPermissions['*']['edit'] = false; $wgGroupPermissions['*']['createaccount'] = false;
I was annoyed by the fact that every time I accessed while not logged in I would get a "You must log in to view other pages" message, and then I would have to click on "log in" to go to the log in dialog, and then after the log in I would get a "You are now logged in" message and with a link to the page I originally wanted to see, and then I would have to click on this link again.
So I decided to patch MediaWiki to transform those into redirects instead of pages with messages. While doing it, I decided to do it in a generic and configurable fashion so that, if you agree that this might be useful to others, you may incorporate it on the main code.
This are the variables that I added to DefaultSettings.php:
/** * Set the $wgRedirectMustLogin flag to skip the "You must log in to * view other pages." notice when you do not have enough rights to view * the page. Set the $wgRedirectLoggedIn flag to skip the "You are now * logged in to ..." notice after you log in successfully. * These are convenient in a private Wiki, if you also set * $wgGroupPermissions['*']['read'], ['edit'] and * ['createaccount'] to false. */ $wgRedirectMustLogin = false; $wgRedirectLoggedIn = false;
If you set the first of them to true on your LocalSettings.php, it will skip the first page. If you set the second one of them to true, it will skip the page that comes after a successful login, and it will jump to the page you originally requested when you got the login dialog.
I am sending the patch attached with this e-mail. I created the patch with a "svn diff" on the trunk of phase3. I tested it against MediaWiki 1.13, it applies cleanly and it works.
I hope you find it useful and incorporate it to MediaWiki!
Thanks, Filipe