Skip to content

Commit

Permalink
MDL-33869 user_get_user_details: allow return of idnumber
Browse files Browse the repository at this point in the history
  • Loading branch information
Crafton Williams authored and danpoltawski committed Jul 31, 2012
1 parent 0876566 commit 3a3f3b2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions enrol/externallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ public static function get_enrolled_users_returns() {
'msn' => new external_value(PARAM_NOTAGS, 'msn number', VALUE_OPTIONAL),
'department' => new external_value(PARAM_TEXT, 'department', VALUE_OPTIONAL),
'institution' => new external_value(PARAM_TEXT, 'institution', VALUE_OPTIONAL),
'idnumber' => new external_value(PARAM_RAW, 'An arbitrary ID code number perhaps from the institution', VALUE_OPTIONAL),
'interests' => new external_value(PARAM_TEXT, 'user interests (separated by commas)', VALUE_OPTIONAL),
'firstaccess' => new external_value(PARAM_INT, 'first access to the site (0 if never)', VALUE_OPTIONAL),
'lastaccess' => new external_value(PARAM_INT, 'last access to the site (0 if never)', VALUE_OPTIONAL),
Expand Down
1 change: 1 addition & 0 deletions user/externallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,7 @@ public static function get_course_user_profiles_returns() {
'msn' => new external_value(PARAM_NOTAGS, 'msn number', VALUE_OPTIONAL),
'department' => new external_value(PARAM_TEXT, 'department', VALUE_OPTIONAL),
'institution' => new external_value(PARAM_TEXT, 'institution', VALUE_OPTIONAL),
'idnumber' => new external_value(PARAM_RAW, 'An arbitrary ID code number perhaps from the institution', VALUE_OPTIONAL),
'interests' => new external_value(PARAM_TEXT, 'user interests (separated by commas)', VALUE_OPTIONAL),
'firstaccess' => new external_value(PARAM_INT, 'first access to the site (0 if never)', VALUE_OPTIONAL),
'lastaccess' => new external_value(PARAM_INT, 'last access to the site (0 if never)', VALUE_OPTIONAL),
Expand Down
5 changes: 4 additions & 1 deletion user/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,11 @@ function user_get_user_details($user, $course = null, array $userfields = array(
}
}

//Departement/Institution are not displayed on any profile, however you can get them from editing profile.
//Departement/Institution/Idnumber are not displayed on any profile, however you can get them from editing profile.
if ($isadmin or $currentuser) {
if (in_array('idnumber', $userfields) && $user->idnumber) {
$userdetails['idnumber'] = $user->idnumber;
}
if (in_array('institution', $userfields) && $user->institution) {
$userdetails['institution'] = $user->institution;
}
Expand Down

0 comments on commit 3a3f3b2

Please sign in to comment.