(bug 15320) Show login page if not logged in (for watchlist)
authorAaron Schulz <aaron@users.mediawiki.org>
Sat, 3 Jan 2009 06:25:24 +0000 (06:25 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Sat, 3 Jan 2009 06:25:24 +0000 (06:25 +0000)
includes/specials/SpecialWatchlist.php

index 61dd6b3..9c9c162 100644 (file)
@@ -20,10 +20,14 @@ function wfSpecialWatchlist( $par ) {
 
        # Anons don't get a watchlist
        if( $wgUser->isAnon() ) {
-               $wgOut->setPageTitle( wfMsg( 'watchnologin' ) );
                $llink = $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Userlogin' ), 
                        wfMsgHtml( 'loginreqlink' ), 'returnto=' . $specialTitle->getPrefixedUrl() );
                $wgOut->addHTML( wfMsgWikiHtml( 'watchlistanontext', $llink ) );
+               # Add login form for convenience
+               $form = new LoginForm( $wgRequest );
+               $form->execute();
+               # Set page title (also LoginForm sets it too, but we prefer this one)
+               $wgOut->setPageTitle( wfMsg( 'watchnologin' ) );
                return;
        }