(bug 8487) Don't show users action watch preferences that aren't applicable
authorRob Church <robchurch@users.mediawiki.org>
Thu, 4 Jan 2007 14:08:51 +0000 (14:08 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Thu, 4 Jan 2007 14:08:51 +0000 (14:08 +0000)
includes/SpecialPreferences.php

index ded82fb..d910dff 100644 (file)
@@ -882,7 +882,19 @@ class PreferencesForm {
                $wgOut->addHtml( '<br /><br />' );
 
                $wgOut->addHtml( $this->getToggles( array( 'watchlisthideown', 'watchlisthidebots', 'watchlisthideminor' ) ) );
-               $wgOut->addHtml( $this->getToggles( array( 'watchdefault', 'watchcreations', 'watchmoves', 'watchdeletion' ) ) );
+               
+               if( $wgUser->isAllowed( 'createpage' ) || $wgUser->isAllowed( 'createtalk' ) )
+                       $wgOut->addHtml( $this->getToggle( 'watchcreations' ) );
+               foreach( array( 'edit' => 'watchdefault', 'move' => 'watchmoves', 'delete' => 'watchdeletion' ) as $action => $toggle ) {
+                       if( $wgUser->isAllowed( $action ) )
+                               $wgOut->addHtml( $this->getToggle( $toggle ) );
+               }
+               $this->mUsedToggles['watchcreations'] = true;
+               $this->mUsedToggles['watchdefault'] = true;
+               $this->mUsedToggles['watchmoves'] = true;
+               $this->mUsedToggles['watchdeletion'] = true;
+               
+               #$wgOut->addHtml( $this->getToggles( array( 'watchdefault', 'watchcreations', 'watchmoves', 'watchdeletion' ) ) );
                
                $wgOut->addHtml( '</fieldset>' );