[Mediawiki-l] Use Special:UserLogin as Main Page
Jim Wilson
wilson.jim.r at gmail.com
Mon Jul 30 21:36:04 UTC 2007
Whoops - copy-paste error:
header("Location: /wiki/Special:UserLogin");
Should be:
header("Location: ".$title->getURL());
On 7/30/07, Jim Wilson <wilson.jim.r at gmail.com> wrote:
>
> 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 at 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 at lists.wikimedia.org
> > http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
> >
>
>
More information about the MediaWiki-l
mailing list