Merge branch 'MDL-59826-master' of https://github.com/snake/moodle

This commit is contained in:
Andrew Nicols 2017-08-22 15:49:11 +08:00
commit 4508e143d8

View File

@ -4185,12 +4185,12 @@ EOD;
}
// Only provide user information if the user is the current user, or a user which the current user can view.
$canviewdetails = false;
if ($user->id == $USER->id || user_can_view_profile($user)) {
$canviewdetails = true;
}
// When checking user_can_view_profile(), either:
// If the page context is course, check the course context (from the page object) or;
// If page context is NOT course, then check across all courses.
$course = ($this->page->context->contextlevel == CONTEXT_COURSE) ? $this->page->course : null;
if ($canviewdetails) {
if (user_can_view_profile($user, $course)) {
// Use the user's full name if the heading isn't set.
if (!isset($heading)) {
$heading = fullname($user);