Commit 868fb3ad authored by Dan Poltawski's avatar Dan Poltawski
Browse files

Merge branch 'MDL-42639_28' of git://github.com/dmonllao/moodle into MOODLE_28_STABLE

parents acd86d0c 0b54d6d9
...@@ -307,8 +307,10 @@ function user_get_user_details($user, $course = null, array $userfields = array( ...@@ -307,8 +307,10 @@ function user_get_user_details($user, $course = null, array $userfields = array(
$userdetails = array(); $userdetails = array();
$userdetails['id'] = $user->id; $userdetails['id'] = $user->id;
if (($isadmin or $currentuser) and in_array('username', $userfields)) { if (in_array('username', $userfields)) {
$userdetails['username'] = $user->username; if ($currentuser or has_capability('moodle/user:viewalldetails', $context)) {
$userdetails['username'] = $user->username;
}
} }
if ($isadmin or $canviewfullnames) { if ($isadmin or $canviewfullnames) {
if (in_array('firstname', $userfields)) { if (in_array('firstname', $userfields)) {
...@@ -460,18 +462,22 @@ function user_get_user_details($user, $course = null, array $userfields = array( ...@@ -460,18 +462,22 @@ 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. // Departement/Institution/Idnumber are not displayed on any profile, however you can get them from editing profile.
if ($isadmin or $currentuser or in_array('idnumber', $showuseridentityfields)) { if (in_array('idnumber', $userfields) && $user->idnumber) {
if (in_array('idnumber', $userfields) && $user->idnumber) { if (in_array('idnumber', $showuseridentityfields) or $currentuser or
has_capability('moodle/user:viewalldetails', $context)) {
$userdetails['idnumber'] = $user->idnumber; $userdetails['idnumber'] = $user->idnumber;
} }
} }
if ($isadmin or $currentuser or in_array('institution', $showuseridentityfields)) { if (in_array('institution', $userfields) && $user->institution) {
if (in_array('institution', $userfields) && $user->institution) { if (in_array('institution', $showuseridentityfields) or $currentuser or
has_capability('moodle/user:viewalldetails', $context)) {
$userdetails['institution'] = $user->institution; $userdetails['institution'] = $user->institution;
} }
} }
if ($isadmin or $currentuser or in_array('department', $showuseridentityfields)) { // Isset because it's ok to have department 0.
if (in_array('department', $userfields) && isset($user->department)) { // Isset because it's ok to have department 0. if (in_array('department', $userfields) && isset($user->department)) {
if (in_array('department', $showuseridentityfields) or $currentuser or
has_capability('moodle/user:viewalldetails', $context)) {
$userdetails['department'] = $user->department; $userdetails['department'] = $user->department;
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment