MDL-26882 profile: Applying cap check (site:viewuseridentity) to email field in user...
authorAnkit Agarwal <ankit@moodle.com>
Mon, 27 Aug 2012 06:38:57 +0000 (14:38 +0800)
committerAnkit Agarwal <ankit@moodle.com>
Mon, 27 Aug 2012 06:48:50 +0000 (14:48 +0800)
user/profile.php

index 87ef59e..7e02c12 100644 (file)
@@ -277,10 +277,11 @@ if (isset($identityfields['idnumber']) && $user->idnumber) {
     print_row(get_string("idnumber").":", "$user->idnumber");\r
 }
 
     print_row(get_string("idnumber").":", "$user->idnumber");\r
 }
 
-if ($currentuser
+if (($currentuser
   or $user->maildisplay == 1
   or has_capability('moodle/course:useremail', $context)
   or $user->maildisplay == 1
   or has_capability('moodle/course:useremail', $context)
-  or ($user->maildisplay == 2 and enrol_sharing_course($user, $USER))) {
+  or ($user->maildisplay == 2 and enrol_sharing_course($user, $USER)))
+  and isset($identityfields['email'])) {
 
     print_row(get_string("email").":", obfuscate_mailto($user->email, ''));
 }
 
     print_row(get_string("email").":", obfuscate_mailto($user->email, ''));
 }