From bb5a2f5aba15290f451e4558b52fbe21d15454e5 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Fri, 18 Apr 2008 15:46:54 +0000 Subject: [PATCH] * Allow the "log in / create account" link in the toolbar to have different text from Special:UserLogin title (new message 'nav-login-createaccount') * Say "log in / create account" if an anonymous user can create an account, otherwise just "log in", consistently across skins. (Currently Monobook always says "log in / create account " and non-Monobook always says "log in".) --- RELEASE-NOTES | 4 ++++ includes/Skin.php | 5 ++++- includes/SkinTemplate.php | 8 ++++++-- languages/messages/MessagesEn.php | 1 + maintenance/language/messages.inc | 1 + 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index d86171ed92..af5c2503e8 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -83,6 +83,10 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * On Special:UserRights, when you can add a group you can't remove or remove one you can't add, a notice is printed to warn you * (bug 12698) Create PAGESIZE parser function, to return the size of a page +* Allow the "log in / create account" link in the toolbar to have different + text from Special:UserLogin title (new message 'nav-login-createaccount') +* Say "log in / create account" if an anonymous user can create an account, + otherwise just "log in", consistently across skins === Bug fixes in 1.13 === diff --git a/includes/Skin.php b/includes/Skin.php index f08cff04f1..77b215c352 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -941,9 +941,12 @@ END; $q = ''; } else { $q = "returnto={$rt}"; } + $loginlink = $wgUser->isAllowed( 'createaccount' ) + ? 'nav-login-createaccount' + : 'login'; $s .= "\n
" . $this->makeKnownLinkObj( SpecialPage::getTitleFor( 'Userlogin' ), - wfMsg( 'login' ), $q ); + wfMsg( $loginlink ), $q ); } else { $n = $wgUser->getName(); $rt = $wgTitle->getPrefixedURL(); diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index f95b20f095..4ba3f21222 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -543,6 +543,10 @@ class SkinTemplate extends Skin { 'active' => false ); } else { + global $wgUser; + $loginlink = $wgUser->isAllowed( 'createaccount' ) + ? 'nav-login-createaccount' + : 'login'; if( $this->showIPinHeader() ) { $href = &$this->userpageUrlDetails['href']; $personal_urls['anonuserpage'] = array( @@ -560,14 +564,14 @@ class SkinTemplate extends Skin { 'active' => ( $pageurl == $href ) ); $personal_urls['anonlogin'] = array( - 'text' => wfMsg('userlogin'), + 'text' => wfMsg( $loginlink ), 'href' => self::makeSpecialUrl( 'Userlogin', 'returnto=' . $this->thisurl ), 'active' => $wgTitle->isSpecial( 'Userlogin' ) ); } else { $personal_urls['login'] = array( - 'text' => wfMsg('userlogin'), + 'text' => wfMsg( $loginlink ), 'href' => self::makeSpecialUrl( 'Userlogin', 'returnto=' . $this->thisurl ), 'active' => $wgTitle->isSpecial( 'Userlogin' ) ); diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index c23ab4431b..83371a248f 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -856,6 +856,7 @@ Do not forget to change your {{SITENAME}} preferences.', 'externaldberror' => 'There was either an external authentication database error or you are not allowed to update your external account.', 'loginproblem' => 'There has been a problem with your login.
Try again!', 'login' => 'Log in', +'nav-login-createaccount' => 'Log in / create account', 'loginprompt' => 'You must have cookies enabled to log in to {{SITENAME}}.', 'userlogin' => 'Log in / create account', 'logout' => 'Log out', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index ef3aeb170a..5f9c58a98a 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -371,6 +371,7 @@ $wgMessageStructure = array( 'externaldberror', 'loginproblem', 'login', + 'nav-login-createaccount', 'loginprompt', 'userlogin', 'logout', -- 2.20.1