Commit c8398fb9 authored by Sam Hemelryk's avatar Sam Hemelryk
Browse files

MDL-45893 user: fixed user menu for guest

parent 2957fddd
......@@ -2956,7 +2956,7 @@ EOD;
$usertextcontents = $opts->metadata['userfullname'];
// Other user.
if ($opts->metadata['asotheruser']) {
if (!empty($opts->metadata['asotheruser'])) {
$avatarcontents .= html_writer::span(
$opts->metadata['realuseravatar'],
'avatar realuser'
......@@ -2977,7 +2977,7 @@ EOD;
}
// Role.
if ($opts->metadata['asotherrole']) {
if (!empty($opts->metadata['asotherrole'])) {
$role = core_text::strtolower(preg_replace('#[ ]+#', '-', trim($opts->metadata['rolename'])));
$usertextcontents .= html_writer::span(
get_string(
......@@ -2993,7 +2993,7 @@ EOD;
}
// MNet.
if ($opts->metadata['asmnetuser']) {
if (!empty($opts->metadata['asmnetuser'])) {
$mnet = strtolower(preg_replace('#[ ]+#', '-', trim($opts->metadata['mnetidprovidername'])));
$usertextcontents .= html_writer::span(
get_string(
......@@ -3019,9 +3019,13 @@ EOD;
$am->set_alignment(action_menu::TR, action_menu::BR);
if ($withlinks) {
foreach ($opts->navitems as $key => $value) {
$pix = null;
if (isset($value->pix)) {
$pix = new pix_icon($value->pix, $value->title, null);
}
$al = new action_menu_link_secondary(
$value->url,
new pix_icon($value->pix, $value->title, null),
$pix,
$value->title,
array('class' => 'icon')
);
......
......@@ -683,8 +683,9 @@ function user_get_user_navigation_info($user, $page) {
// Build a list of items for a guest.
$login = new stdClass();
$login->url = get_login_url();
$login->url = new moodle_url(get_login_url());
$login->title = get_string('login');
// TODO MDL-47457: we should be setting a login icon here.
$returnobject->navitems[] = $login;
} else {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment