(bug 19600) don't display searchmenu-new when user has not got permission to
authorConrad Irwin <conrad@users.mediawiki.org>
Wed, 27 Jan 2010 03:06:56 +0000 (03:06 +0000)
committerConrad Irwin <conrad@users.mediawiki.org>
Wed, 27 Jan 2010 03:06:56 +0000 (03:06 +0000)
create the page.

includes/specials/SpecialSearch.php

index fe1e3cb..da054e0 100644 (file)
@@ -319,16 +319,20 @@ class SpecialSearch {
        protected function showCreateLink( $t ) {
                global $wgOut;
                
-               // show direct page/create link
+               // show direct page/create link if applicable
+               $messageName = null;
                if( !is_null($t) ) {
-                       if( !$t->isKnown() ) {
-                               $wgOut->addWikiMsg( 'searchmenu-new', wfEscapeWikiText( $t->getPrefixedText() ) );
-                       } else {
-                               $wgOut->addWikiMsg( 'searchmenu-exists', wfEscapeWikiText( $t->getPrefixedText() ) );
+                       if( $t->isKnown() ) {
+                               $messageName = 'searchmenu-exists';
+                       } elseif( $t->userCan( 'create' ) ) {
+                               $messageName = 'searchmenu-new';
                        }
+               } 
+               if( $messageName ) {
+                       $wgOut->addWikiMsg( $messageName, wfEscapeWikiText( $t->getPrefixedText() ) );
                } else {
                        // preserve the paragraph for margins etc...
-                       $wgOut->addHTML('<p></p>');
+                       $wgOut->addHtml( '<p></p>' );
                }
        }