diff --git a/lib/myprofilelib.php b/lib/myprofilelib.php index c0c5c2efc3a..162db364543 100644 --- a/lib/myprofilelib.php +++ b/lib/myprofilelib.php @@ -144,12 +144,13 @@ function core_myprofile_navigation(core_user\output\myprofile\tree $tree, $user, $tree->add_node($node); } - // Printing tagged interests. We want this only for full profile. - if (!empty($CFG->usetags) && empty($course)) { - if ($interests = tag_get_tags_csv('user', $user->id) ) { - $node = new core_user\output\myprofile\node('contact', 'interests', get_string('interests'), null, null, $interests); - $tree->add_node($node); - } + if (isset($identityfields['email']) and ($iscurrentuser + or $user->maildisplay == 1 + or has_capability('moodle/course:useremail', $usercontext) + or ($user->maildisplay == 2 and enrol_sharing_course($user, $USER)))) { + $node = new core_user\output\myprofile\node('contact', 'email', get_string('email'), null, null, + obfuscate_mailto($user->email, '')); + $tree->add_node($node); } if (!isset($hiddenfields['country']) && $user->country) { @@ -196,15 +197,6 @@ function core_myprofile_navigation(core_user\output\myprofile\tree $tree, $user, $tree->add_node($node); } - if (isset($identityfields['email']) and ($iscurrentuser - or $user->maildisplay == 1 - or has_capability('moodle/course:useremail', $usercontext) - or ($user->maildisplay == 2 and enrol_sharing_course($user, $USER)))) { - $node = new core_user\output\myprofile\node('contact', 'email', get_string('email'), null, null, - obfuscate_mailto($user->email, '')); - $tree->add_node($node); - } - if ($user->url && !isset($hiddenfields['webpage'])) { $url = $user->url; if (strpos($user->url, '://') === false) { @@ -215,6 +207,14 @@ function core_myprofile_navigation(core_user\output\myprofile\tree $tree, $user, $tree->add_node($node); } + // Printing tagged interests. We want this only for full profile. + if (!empty($CFG->usetags) && empty($course)) { + if ($interests = tag_get_tags_csv('user', $user->id) ) { + $node = new core_user\output\myprofile\node('contact', 'interests', get_string('interests'), null, null, $interests); + $tree->add_node($node); + } + } + if (!isset($hiddenfields['mycourses'])) { $showallcourses = optional_param('showallcourses', 0, PARAM_INT); if ($mycourses = enrol_get_all_users_courses($user->id, true, null, 'visible DESC, sortorder ASC')) {