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.
This commit is contained in:
Fábio Souto
2012-05-21 10:36:32 +01:00
parent 14fdcb4f13
commit cd358c666f
+3 -2
View File
@@ -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)) {