I'd probably take it in this direction:
<?php class MainPageLoginRedirect extends SpecialPage { function MyExtension() { SpecialPage::SpecialPage("MainPageLoginRedirect"); }
function execute( $par ) { global $wgUser, $wgOut; $wgOut->disable(); if ( $wgUser->isLoggedIn() ) { $title = Title::newFromText(wfMsgForContent('realmainpage')); if (!$title) $title = Title::newFromText('Main Page'); } else { $title = Title::newFromText('Special:UserLogin'); } header("Location: /wiki/Special:UserLogin");
exit(0); #TODO: Send the redirect using the Mediawiki function. } } ?>
And set [[MediaWiki:Realmainpage]] to the real main page.
-- Jim R. Wilson (jimbojw)
On 7/30/07, Platonides Platonides@gmail.com wrote:
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. } } ?>
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l