';
$headerinfo = array('heading' => fullname($user), 'user' => $user, 'usercontext' => $usercontext);
echo $OUTPUT->context_header($headerinfo, 2);
if ($user->deleted) {
echo $OUTPUT->heading(get_string('userdeleted'));
if (!has_capability('moodle/user:update', $coursecontext)) {
echo $OUTPUT->footer();
die;
}
}
// OK, security out the way, now we are showing the user.
// Trigger a user profile viewed event.
profile_view($user, $coursecontext, $course);
if ($user->description && !isset($hiddenfields['description'])) {
echo '
';
if (!empty($CFG->profilesforenrolledusersonly) && !$DB->record_exists('role_assignments', array('userid' => $id))) {
echo get_string('profilenotshown', 'moodle');
} else {
if ($courseid == SITEID) {
$user->description = file_rewrite_pluginfile_urls($user->description, 'pluginfile.php', $usercontext->id, 'user', 'profile', null);
} else {
// We have to make a little detour thought the course context to verify the access control for course profile.
$user->description = file_rewrite_pluginfile_urls($user->description, 'pluginfile.php', $coursecontext->id, 'user', 'profile', $user->id);
}
$options = array('overflowdiv' => true);
echo format_text($user->description, $user->descriptionformat, $options);
}
echo '
'; // Description class.
}
// Render custom blocks.
$renderer = $PAGE->get_renderer('core_user', 'myprofile');
$tree = core_user\output\myprofile\manager::build_tree($user, $currentuser, $course);
echo $renderer->render($tree);
echo '
'; // Userprofile class.
echo $OUTPUT->footer();