From 0014c1113cef2eab5601500575a9de0c68dc2f53 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Tue, 4 Jan 2011 02:48:02 +0000 Subject: [PATCH] * (bug 26558) list=allusers auprop=groups does not list groups a user is automatically a member of --- RELEASE-NOTES | 1 + includes/api/ApiQueryAllUsers.php | 4 ++++ includes/api/ApiQueryUsers.php | 1 + 3 files changed, 6 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 69a5d88e5e..ff3b49b9d4 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -67,6 +67,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 26541) Generator-ise ApiQueryRecentChanges * action=parse now correctly returns an error for nonexistent pages * (bug 25767) Add userrights properties to allusers and users query lists +* (bug 26558) list=allusers auprop=groups does not list groups a user is automatically a member of === Languages updated in 1.18 === diff --git a/includes/api/ApiQueryAllUsers.php b/includes/api/ApiQueryAllUsers.php index 36f4f00760..a7994b64c5 100644 --- a/includes/api/ApiQueryAllUsers.php +++ b/includes/api/ApiQueryAllUsers.php @@ -201,6 +201,10 @@ class ApiQueryAllUsers extends ApiQueryBase { // Add user's group info if ( $fld_groups && !is_null( $row->ug_group2 ) ) { + if ( !isset( $lastUserData['groups'] ) ) { + $lastUserData['groups'] = ApiQueryUsers::getAutoGroups( User::newFromName( $lastUser ) ); + } + $lastUserData['groups'][] = $row->ug_group2; $result->setIndexedTagName( $lastUserData['groups'], 'g' ); } diff --git a/includes/api/ApiQueryUsers.php b/includes/api/ApiQueryUsers.php index fa90c389a2..59fcbf7f6a 100644 --- a/includes/api/ApiQueryUsers.php +++ b/includes/api/ApiQueryUsers.php @@ -229,6 +229,7 @@ if ( !defined( 'MEDIAWIKI' ) ) { /** * Gets all the groups that a user is automatically a member of + * @param $user User * @return array */ public static function getAutoGroups( $user ) { -- 2.20.1