Permalink
Browse files

Moved code from footer.html into print_footer()

Don't update user on login check if it isn't a real user.
  • Loading branch information...
1 parent c6f1b8a commit 3ce2f1e08a73a4493d03aa9c2a959f62287455b0 martin committed Aug 11, 2002
Showing with 16 additions and 1 deletion.
  1. +16 −1 lib/moodlelib.php
View
@@ -47,6 +47,19 @@ function print_footer ($course=NULL) {
} else {
$homelink = "<A TARGET=_top HREF=\"$CFG->wwwroot\">Home</A>";
}
+ if ($USER->realuser) {
+ if ($realuser = get_record("user", "id", $USER->realuser)) {
+ $realuserinfo = " [$realuser->firstname $realuser->lastname] ";
+ }
+ }
+ if ($USER->id) {
+ $loggedinas = $realuserinfo.get_string("loggedinas", "moodle", "$USER->firstname $USER->lastname").
+ " (<A HREF=\"$CFG->wwwroot/login/logout.php\">".get_string("logout")."</A>)";
+ } else {
+ $loggedinas = get_string("loggedinnot", "moodle").
+ " (<A HREF=\"$CFG->wwwroot/login/\">".get_string("login")."</A>)";
+ }
+
include ("$CFG->dirroot/theme/$CFG->theme/footer.html");
}
@@ -921,7 +934,9 @@ function require_login($courseid=0) {
// Next, check if the user can be in a particular course
if ($courseid) {
if ($USER->student[$courseid] || $USER->teacher[$courseid] || $USER->admin) {
- update_user_in_db();
+ if (!isset($USER->realuser)) { // Don't log if this isn't a realuser
+ update_user_in_db();
+ }
return; // user is a member of this course.
}
if (! $course = get_record("course", "id", $courseid)) {

0 comments on commit 3ce2f1e

Please sign in to comment.