Moodle

Display user name at top of pages and make it a logout link too

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Trivial Trivial
  • Resolution: Fixed
  • Affects Version/s: 1.0.9
  • Fix Version/s: None
  • Component/s: General
  • Labels:
    None
  • Environment:
    All
  • Affected Branches:
    MOODLE_10_STABLE

Description

It's helpful to see a username at the top of a page. As I move around a computer lab peeking at student screens I can be easily reminded who they are. And it's a very visible sign to newbies that they are actually logged in. And as I'm developing the course and moving in and of user roles it 's real easy way to keep track of who I am to quit being that role too. I recently read a forum post in which another person said this would be nice too. So I thought I'd offer my solution. I hope the code isn't too crummy (I'm awfully new to php and mysql). Maybe you will like the idea and have better code than mine!!! Maybe this could be an on/off option in the site settings, to give people a choice.

adding username at the top that is a link to log out.

places the name centered under logo on home page and everywhere there was a top of page logout link on other pages.

Edited two files (theme/mm is my personal theme)

1. display the user name on the home page, centered just under the logo

edit theme/mm/header.html

at about line 17, just under the line that calls the logo (in the standardlogo theme) I inserted this:

<!-- paula added display of user name on home page, centered

under the logo; the name is a logout link - the link title

displays the label logout when hovered

insert new code on next line -->

<br><center><font size=1><a href=login/logout.php title=Logout><? echo $USER->firstname $USER->lastname; ?></a></font></center>

<!-- stop paula -->

2. Now, replace the existing text logout link with the user name as logout link. again, the title attribute provides a reminder label when you hover the link

edit lib/weblib.php at about line 597

// paula this replaces the logout link text with the user name - replace the following line

// $menu = <FONT SIZE=2><A TARGET=_parent HREF=\$CFG->wwwroot/login/logout.php\ >.get_string(logout).</A></FONT>;

// with this new line

$menu = <FONT SIZE=2><A title=\Logout\ TARGET=_parent HREF=\$CFG->wwwroot/login/logout.php\>$USER->firstname $USER->lastname</A></FONT>;

// stop paula

Activity

Hide
Martin Dougiamas added a comment -

From Martin Dougiamas (martin at moodle.com) Saturday, 19 April 2003, 09:59 PM:

I agree it's a good idea to get the username up the top, at least as an option, but I don't think it should be a logout link, for interface consistency reasons: Names should always be links to user pages - being logged out could be quite surprising.

It might however be possible to put

Firstname Lastname (Logout)

much like the bottom-of-page arrangment.

From Martin Dougiamas (martin at moodle.com) Sunday, 27 April 2003, 01:20 PM:

I've put this link on the course home page (it's not simple to put it everywhere because information about the current course is not passed to print_header)

Show
Martin Dougiamas added a comment - From Martin Dougiamas (martin at moodle.com) Saturday, 19 April 2003, 09:59 PM: I agree it's a good idea to get the username up the top, at least as an option, but I don't think it should be a logout link, for interface consistency reasons: Names should always be links to user pages - being logged out could be quite surprising. It might however be possible to put Firstname Lastname (Logout) much like the bottom-of-page arrangment. From Martin Dougiamas (martin at moodle.com) Sunday, 27 April 2003, 01:20 PM: I've put this link on the course home page (it's not simple to put it everywhere because information about the current course is not passed to print_header)
Hide
Michael Blake added a comment -

assign to a valid user

Show
Michael Blake added a comment - assign to a valid user

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: