Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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.
  • Loading branch information...
commit cd358c666f02f3afd933f7cba8f887636bc64683 1 parent 14fdcb4
@fabiomsouto fabiomsouto authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 user/lib.php
View
5 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)) {
Please sign in to comment.
Something went wrong with that request. Please try again.