Jump to: navigation, search

Obsolete

This patch has been replaced by an extension described in the parent article at Project:Config:Wiki#ExcludeHiddenGroups.

Patch against MediaWiki 1.5.x

This applies cleanly to at least 1.5.8; probably to all 1.5.x releases.

--- SpecialListusers.php        2006-03-22 14:18:29.000000000 +1100
+++ SpecialListusers.new.php    2006-03-22 14:15:39.000000000 +1100
@@ -152,7 +152,7 @@
        }
 
        function formatResult( $skin, $result ) {
-               global $wgContLang;
+               global $wgContLang, $wgHiddenGroups;
 
                $userPage = Title::makeTitle( $result->namespace, $result->title );
                $name = $skin->makeLinkObj( $userPage, htmlspecialchars( $userPage->getText() ) );
@@ -170,10 +170,16 @@
                        $dbr->freeResult( $result );
 
                        if( count( $groups ) > 0 ) {
-                               $name .= ' (' .
-                                       $skin->makeLink( wfMsgForContent( 'administrators' ),
-                                               htmlspecialchars( implode( ', ', $groups ) ) ) .
-                                       ')';
+                               if ($this->requestedGroup == '' &&
+                                 isset($wgHiddenGroups) &&
+                                 count(array_intersect($wgHiddenGroups, $groups)) > 0) {
+                                       $name = '';
+                               } else {
+                                       $name .= ' (' .
+                                               $skin->makeLink( wfMsgForContent( 'administrators' ),
+                                                       htmlspecialchars( implode( ', ', $groups ) ) ) .
+                                               ')';
+                               }
                        }
                }
 

Patch against MediaWiki 1.6.x

This applies cleanly to 1.6.5 and 1.6.6; probably to all 1.6.x, x <= 6, releases.

--- SpecialListusers.php	2006-05-29 00:55:11.000000000 +1000
+++ SpecialListusers.new.php	2006-05-29 00:55:48.000000000 +1000
@@ -190,10 +190,17 @@
 			$dbr->freeResult( $result );
 
 			if( count( $groups ) > 0 ) {
-				$name .= ' (' .
-					$skin->makeLink( wfMsgForContent( 'administrators' ),
-						htmlspecialchars( implode( ', ', $groups ) ) ) .
-					')';
+				global $wgHiddenGroups;
+				if ($this->requestedGroup == '' &&
+				 isset($wgHiddenGroups) &&
+				 count(array_intersect($wgHiddenGroups, $groups)) > 0) {
+					$name = '';
+				} else {
+					$name .= ' (' .
+						$skin->makeLink( wfMsgForContent( 'administrators' ),
+							htmlspecialchars( implode( ', ', $groups ) ) ) .
+						')';
+                               }
 			}
 		}
 
 

Patch against svn head, 20060529

This is a preparatory patch that applies cleanly to MediaWiki's subversion repository head as at 29 May 2006.

--- SpecialListusers.php	2006-05-29 01:49:48.000000000 +1000
+++ SpecialListusers.new.php	2006-05-29 01:49:39.000000000 +1000
@@ -193,7 +193,13 @@
 			$dbr->freeResult( $result );
 
 			if( count( $groups ) > 0 ) {
-				foreach( $groups as $group => $desc ) {
+				global $wgHiddenGroups;
+				if ($this->requestedGroup == '' &&
+				 isset($wgHiddenGroups) &&
+				 count(array_intersect($wgHiddenGroups, $groups)) > 0) {
+					$list = array();
+					$name = '';
+				} else foreach( $groups as $group => $desc ) {
 					if( $page = User::getGroupPage( $group ) ) {
 						$list[] = $skin->makeLinkObj( $page, htmlspecialchars( $desc ) );
 					} else {
@@ -207,7 +213,7 @@
 
 		}
 
-		return wfSpecialList( $name, $groups );
+		return $name ? wfSpecialList( $name, $groups ) : $name;
 	}
 }
 
 

Patch against MediaWiki 1.9.2

--- SpecialListusers.php.orig	2007-02-05 10:15:00.000000000 +1100
+++ SpecialListusers.php	2007-02-10 21:50:26.000000000 +1100
@@ -191,7 +191,13 @@
 			$dbr->freeResult( $result );
 
 			if( count( $groups ) > 0 ) {
-				foreach( $groups as $group => $desc ) {
+				global $wgHiddenGroups;
+				if ($this->requestedGroup == '' &&
+				 isset($wgHiddenGroups) &&
+				 count(array_intersect($wgHiddenGroups, $groups)) > 0) {
+					$list = array();
+					$name = '';
+				} else foreach( $groups as $group => $desc ) {
 					$list[] = User::makeGroupLinkHTML( $group, $desc );
 				}
 				$groups = implode( ', ', $list );
@@ -201,7 +207,7 @@
 
 		}
 
-		return wfSpecialList( $name, $groups );
+		return $name ? wfSpecialList( $name, $groups ) : $name;
 	}
 }
 
 
Personal tools