MDL-45893 user: fixed user menu for guest

This commit is contained in:
Sam Hemelryk 2014-09-30 10:25:23 +13:00
parent 2957fdddd5
commit c8398fb95a
2 changed files with 10 additions and 5 deletions

View File

@ -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')
);

View File

@ -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 {