From 5b68a32d0702388fc4a15ffb808b3bd0b00cd433 Mon Sep 17 00:00:00 2001 From: Daniel Friesen Date: Sat, 1 Jan 2011 17:38:15 +0000 Subject: [PATCH] Add a realname option to query=userinfo in the api. --- RELEASE-NOTES | 1 + includes/api/ApiQueryUserInfo.php | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 6a200b5a48..62a1dca441 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -56,6 +56,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 14869) Add API module for accessing QueryPage-based special pages * (bug 14020) API for Special:Unwatchedpages * (bug 24287) Wrap API Help output at 100 characters +* Add a realname uiprop option to query=userinfo so a user's realname can be extracted === Languages updated in 1.18 === diff --git a/includes/api/ApiQueryUserInfo.php b/includes/api/ApiQueryUserInfo.php index d2c07e4626..112fbb339a 100644 --- a/includes/api/ApiQueryUserInfo.php +++ b/includes/api/ApiQueryUserInfo.php @@ -117,6 +117,10 @@ class ApiQueryUserInfo extends ApiQueryBase { $vals['ratelimits'] = $this->getRateLimits(); } + if ( isset( $this->prop['realname'] ) ) { + $vals['realname'] = $wgUser->getRealName(); + } + if ( isset( $this->prop['email'] ) ) { $vals['email'] = $wgUser->getEmail(); $auth = $wgUser->getEmailAuthenticationTimestamp(); @@ -189,6 +193,7 @@ class ApiQueryUserInfo extends ApiQueryBase { 'editcount', 'ratelimits', 'email', + 'realname', 'acceptlang', ) ) @@ -207,6 +212,7 @@ class ApiQueryUserInfo extends ApiQueryBase { ' options - Lists all preferences the current user has set', ' editcount - Adds the current user\'s edit count', ' ratelimits - Lists all rate limits applying to the current user', + ' realname - Adds the user\'s real name', ' email - Adds the user\'s email address and email authentication date', ' acceptlang - Echoes the Accept-Language header sent by the client in a structured format', ) -- 2.20.1