From 8689879ad13f8232be364cad80984755e7685385 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Tue, 2 Feb 2010 15:59:47 +0000 Subject: [PATCH] * (bug 21518) Special:UserRights no longer displays the user name box for users that can only change their rights * changed empty() to !count() * break line at 80 chars in RELEASE-NOTES --- RELEASE-NOTES | 5 ++++- includes/specials/SpecialUserrights.php | 8 +++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 4e9f643b8d..17b8ea3a4e 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -730,7 +730,10 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 21870) No longer include Google logo from an external server on wiki error. * (bug 22181) Do not truncate if the ellipsis actually make the string longer * (bug 16039) Text disappearing after a bad image -* (bug 18784) Internal links like [[File:Foo|caption]] should read 'caption', not 'File:Foo' when Foo is not an image +* (bug 18784) Internal links like [[File:Foo|caption]] should read 'caption', + not 'File:Foo' when Foo is not an image +* (bug 21518) Special:UserRights no longer displays the user name box for users + that can only change their rights == API changes in 1.16 == diff --git a/includes/specials/SpecialUserrights.php b/includes/specials/SpecialUserrights.php index d3c9a31aa1..59dabf90c4 100644 --- a/includes/specials/SpecialUserrights.php +++ b/includes/specials/SpecialUserrights.php @@ -65,14 +65,15 @@ class UserrightsPage extends SpecialPage { return; } + $available = $this->changeableGroups(); + if ( !$this->mTarget ) { /* * If the user specified no target, and they can only * edit their own groups, automatically set them as the * target. */ - $available = $this->changeableGroups(); - if ( empty( $available['add'] ) && empty( $available['remove'] ) ) + if ( !count( $available['add'] ) && !count( $available['remove'] ) ) $this->mTarget = $wgUser->getName(); } @@ -100,7 +101,8 @@ class UserrightsPage extends SpecialPage { $this->setHeaders(); // show the general form - $this->switchForm(); + if ( count( $available['add'] ) || count( $available['remove'] ) ) + $this->switchForm(); if( $wgRequest->wasPosted() ) { // save settings -- 2.20.1