From abb9d3618d57c73396d467816da505ef72589dea Mon Sep 17 00:00:00 2001 From: Tobias Date: Mon, 7 Sep 2009 16:21:10 +0000 Subject: [PATCH] New message noarticletext-nopermission that does not include misleading link 'edit this page' if user is not allowed to create the page. --- RELEASE-NOTES | 2 ++ includes/Article.php | 5 ++++- languages/messages/MessagesEn.php | 3 +++ maintenance/language/messages.inc | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index e51332d3db..58d906bcff 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -467,6 +467,8 @@ this. Was used when mwEmbed was going to be an extension. argument * (bug 20136) Protection form JavaScript now synchronizes the expiry boxes on any change, in addition to onkeyup. +* Don't link to "edit this page" on MediaWiki:Noarticletext if user is not allowed + to create page. Done via new message MediaWiki:Noarticletext-nopermission == API changes in 1.16 == diff --git a/includes/Article.php b/includes/Article.php index 8f6e33d61c..9e8e370cf4 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1213,7 +1213,10 @@ class Article { // Use the default message text $text = $this->getContent(); } else { - $text = wfMsgNoTrans( 'noarticletext' ); + if ( $this->mTitle->userCan( 'edit' ) ) + $text = wfMsgNoTrans( 'noarticletext' ); + else + $text = wfMsgNoTrans( 'noarticletext-nopermission' ); } $text = "
\n$text\n
"; if( !$this->hasViewableContent() ) { diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index c5b8daff97..9a9638e702 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1247,6 +1247,9 @@ If you are an anonymous user and feel that irrelevant comments have been directe You can [[Special:Search/{{PAGENAME}}|search for this page title]] in other pages, [{{fullurl:Special:Log|page={{urlencode:{{FULLPAGENAME}}}}}} search the related logs], or [{{fullurl:{{FULLPAGENAME}}|action=edit}} edit this page].', +'noarticletext-nopermission' => 'There is currently no text in this page. +You can [[Special:Search/{{PAGENAME}}|search for this page title]] in other pages, +or [{{fullurl:Special:Log|page={{urlencode:{{FULLPAGENAME}}}}}} search the related logs].', 'noarticletextanon' => '{{int:noarticletext}}', # do not translate or duplicate this message to other languages 'userpage-userdoesnotexist' => 'User account "$1" is not registered. Please check if you want to create/edit this page.', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 4b8f47e90a..80136c0340 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -537,6 +537,7 @@ $wgMessageStructure = array( 'talkpagetext', 'anontalkpagetext', 'noarticletext', + 'noarticletext-nopermission', 'noarticletextanon', 'userpage-userdoesnotexist', 'clearyourcache', -- 2.20.1