[Mediawiki-l] Use Special:UserLogin as Main Page

Platonides Platonides at gmail.com
Mon Jul 30 21:07:21 UTC 2007


Jason Spirko wrote:
> Thanks Platonides, where would I place this code? I tried in the
> LocalSettings.php and it does not seem to work.

Write an special page.

<?php
class MainPageLoginRedirect extends SpecialPage
{
         function MyExtension() {
                 SpecialPage::SpecialPage("MainPageLoginRedirect");
         }

         function execute( $par ) {
		global $wgUser;
		if ( $wgUser->isLoggedIn() )
		    header("Location: /wiki/Real_Main_Page"); //Issues a 302 Redirect
		else
		    header("Location: /wiki/Special:UserLogin");

		exit(0);
	        #TODO: Send the redirect using the Mediawiki function.
	}
}
?>




More information about the MediaWiki-l mailing list