From cd358c666f02f3afd933f7cba8f887636bc64683 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Souto?= Date: Wed, 8 Feb 2012 10:57:37 +0000 Subject: [PATCH] Allow admin to consult user email address Currently the admin user cannot check the user email using this function. This fix allows the admin user to retrieve the email in any situation. --- user/lib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/user/lib.php b/user/lib.php index cd8dc63c086..d0a1f7a56e9 100644 --- a/user/lib.php +++ b/user/lib.php @@ -356,8 +356,9 @@ function user_get_user_details($user, $course = null, array $userfields = array( if (in_array('email', $userfields) && ($currentuser or $canviewuseremail // this is a capability in course context, it will be false in usercontext or $user->maildisplay == 1 - or ($user->maildisplay == 2 and enrol_sharing_course($user, $USER)))) { - $userdetails['email'] = $user->email;; + or ($user->maildisplay == 2 and enrol_sharing_course($user, $USER)) + or $isadmin)) { + $userdetails['email'] = $user->email; } if (in_array('interests', $userfields) && !empty($CFG->usetags)) {