Browse files

Changed the login info string when a user is using 'switch roles'

  • Loading branch information...
1 parent 09edb37 commit 91ea292e65105f62fecee8ccaf7281337c3222e2 moodler committed Sep 21, 2006
Showing with 8 additions and 0 deletions.
  1. +8 −0 lib/weblib.php
View
8 lib/weblib.php
@@ -2609,6 +2609,14 @@ function user_login_string($course=NULL, $user=NULL) {
if (isset($user->username) && $user->username == 'guest') {
$loggedinas = $realuserinfo.get_string('loggedinasguest').
" (<a target=\"{$CFG->framename}\" href=\"$wwwroot/login/index.php\">".get_string('login').'</a>)';
+ } else if (!empty($user->switchrole)) {
+ $rolename = '';
+ if ($role = get_record('role', 'id', $user->switchrole)) {
+ $rolename = ': '.format_string($role->name);
+ }
+ $loggedinas = get_string('loggedinas', 'moodle', $username).$rolename.
+ " (<a target=\"{$CFG->framename}\"
+ href=\"$CFG->wwwroot/course/view.php?id=$course->id&amp;switchrole=0&amp;sesskey=".sesskey()."\">".get_string('switchrolereturn').'</a>)';
} else {
$loggedinas = $realuserinfo.get_string('loggedinas', 'moodle', $username).' '.
" (<a target=\"{$CFG->framename}\" href=\"$CFG->wwwroot/login/logout.php\">".get_string('logout').'</a>)';

0 comments on commit 91ea292

Please sign in to comment.