mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-38136: fix user_get_user_details doesn't return idnumber (thanks to Antonio Carlos Mariani)
This commit is contained in:
parent
e0cded5d44
commit
58f739c5fd
12
user/lib.php
12
user/lib.php
@ -326,11 +326,11 @@ function user_get_user_details($user, $course = null, array $userfields = array(
|
||||
}
|
||||
|
||||
if ($user->phone1 && in_array('phone1', $userfields) &&
|
||||
(isset($showuseridentityfields['phone1']) or $canviewhiddenuserfields)) {
|
||||
(in_array('phone1', $showuseridentityfields) or $canviewhiddenuserfields)) {
|
||||
$userdetails['phone1'] = $user->phone1;
|
||||
}
|
||||
if ($user->phone2 && in_array('phone2', $userfields) &&
|
||||
(isset($showuseridentityfields['phone2']) or $canviewhiddenuserfields)) {
|
||||
(in_array('phone2', $showuseridentityfields) or $canviewhiddenuserfields)) {
|
||||
$userdetails['phone2'] = $user->phone2;
|
||||
}
|
||||
|
||||
@ -396,7 +396,7 @@ function user_get_user_details($user, $course = null, array $userfields = array(
|
||||
if (in_array('email', $userfields) && ($isadmin // The admin is allowed the users email
|
||||
or $currentuser // Of course the current user is as well
|
||||
or $canviewuseremail // this is a capability in course context, it will be false in usercontext
|
||||
or isset($showuseridentityfields['email'])
|
||||
or in_array('email', $showuseridentityfields)
|
||||
or $user->maildisplay == 1
|
||||
or ($user->maildisplay == 2 and enrol_sharing_course($user, $USER)))) {
|
||||
$userdetails['email'] = $user->email;
|
||||
@ -410,17 +410,17 @@ function user_get_user_details($user, $course = null, array $userfields = array(
|
||||
}
|
||||
|
||||
//Departement/Institution/Idnumber are not displayed on any profile, however you can get them from editing profile.
|
||||
if ($isadmin or $currentuser or isset($showuseridentityfields['idnumber'])) {
|
||||
if ($isadmin or $currentuser or in_array('idnumber', $showuseridentityfields)) {
|
||||
if (in_array('idnumber', $userfields) && $user->idnumber) {
|
||||
$userdetails['idnumber'] = $user->idnumber;
|
||||
}
|
||||
}
|
||||
if ($isadmin or $currentuser or isset($showuseridentityfields['institution'])) {
|
||||
if ($isadmin or $currentuser or in_array('institution', $showuseridentityfields)) {
|
||||
if (in_array('institution', $userfields) && $user->institution) {
|
||||
$userdetails['institution'] = $user->institution;
|
||||
}
|
||||
}
|
||||
if ($isadmin or $currentuser or isset($showuseridentityfields['department'])) {
|
||||
if ($isadmin or $currentuser or in_array('department', $showuseridentityfields)) {
|
||||
if (in_array('department', $userfields) && isset($user->department)) { //isset because it's ok to have department 0
|
||||
$userdetails['department'] = $user->department;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user