Last active
December 28, 2015 06:29
-
-
Save eggsurplus/7457113 to your computer and use it in GitHub Desktop.
custom/clients/base/api/WikiCurrentUserApi.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_once 'clients/base/api/CurrentUserApi.php'; | |
class WikiCurrentUserApi extends CurrentUserApi | |
{ | |
/** | |
* Override the core api with our own versoin of retrieveCurrentUser | |
*/ | |
public function registerApiRest() | |
{ | |
return array( | |
'retrieve' => array( | |
'reqType' => 'GET', | |
'path' => array('me',), | |
'pathVars' => array(), | |
'method' => 'retrieveCurrentUser', | |
'shortHelp' => 'Returns current user', | |
'longHelp' => 'include/api/help/me_get_help.html', | |
'ignoreMetaHash' => true, | |
'ignoreSystemStatusError' => true, //thank you Francesca! | |
), | |
); | |
} | |
/** | |
* Extends retrieveCurrentUser and add our custom data | |
*/ | |
public function retrieveCurrentUser($api, $args) | |
{ | |
$user_data_array = parent::retrieveCurrentUser($api, $args); | |
global $current_user; | |
$user_data_array['current_user']['wiki_user'] = $current_user->wiki_user_c; | |
return $user_data_array; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment