r49056 - Code Review

From MediaWiki.org

Jump to: navigation, search
Repository:MediaWiki
Revision:r49055 | r49056 (on ViewVC) | r49057 >
Date:03:48, 31 March 2009
Author:soxred93
Status:resolved (Comments)
Tags:ok 
Comment:Added usprop=gender to list=users
Modified paths:

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryUsers.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryUsers.php	(revision 49055)
+++ trunk/phase3/includes/api/ApiQueryUsers.php	(revision 49056)
@@ -145,6 +145,8 @@
 				}
 				if(isset($this->prop['emailable']) && $user->canReceiveEmail())
 					$data[$name]['emailable'] = '';
+				if(isset($this->prop['gender']))
+					$data[$name]['gender'] = $user->getOption( 'gender' );
 				if(!is_null($params['token']))
 				{
 					$tokenFunctions = $this->getTokenFunctions();
@@ -191,6 +193,7 @@
 					'editcount',
 					'registration',
 					'emailable',
+					'gender',
 				)
 			),
 			'users' => array(
@@ -212,6 +215,7 @@
 				'  editcount    - adds the user\'s edit count',
 				'  registration - adds the user\'s registration timestamp',
 				'  emailable    - tags if the user can and wants to receive e-mail through [[Special:Emailuser]]',
+				'  gender       - tags the gender of the user. Returns "male", "female", or "unknown"',
 			),
 			'users' => 'A list of users to obtain the same information for',
 			'token' => 'Which tokens to obtain for each user',
@@ -223,7 +227,7 @@
 	}
 
 	protected function getExamples() {
-		return 'api.php?action=query&list=users&ususers=brion|TimStarling&usprop=groups|editcount';
+		return 'api.php?action=query&list=users&ususers=brion|TimStarling&usprop=groups|editcount|gender';
 	}
 
 	public function getVersion() {
Index: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES	(revision 49055)
+++ trunk/phase3/RELEASE-NOTES	(revision 49056)
@@ -364,6 +364,7 @@
 * (bug 18099) Using appendtext to edit a non-existent page causes an interface
   message to be included in the page text
 * Added uiprop=changeablegroups to meta=userinfo
+* Added usprop=gender to list=users
 
 === Languages updated in 1.15 ===
 

Follow-up revisions

RevisionCommit summaryAuthorDate
r51411Followup to r49056: gender property gives "unknown" when gender option is nulltstarling15:36, 3 June 2009

Comments

#Comment by Brion VIBBER (Talk | contribs)   20:43, 18 May 2009

This returns "" for accounts which haven't selected a setting. Should it be normalized per the doc?

Status & tagging log

Views
Toolbox