MDL-31520 user-ws: Optimised if statement for email access by moving admin check to the start

This commit is contained in:
Sam Hemelryk
2012-06-06 10:38:20 +12:00
parent 4c3a1c6f8a
commit d099f4fd0e
+3 -3
View File
@@ -309,11 +309,11 @@ function user_get_user_details($user, $course = null) {
}
}
if ($currentuser
if ($isadmin
of $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))
or $isadmin) {
or ($user->maildisplay == 2 and enrol_sharing_course($user, $USER))) {
$userdetails['email'] = $user->email;;
}