]> git.mjollnir.org Git - moodle.git/commitdiff
Make sure we still log the fact that the teacher logged in as someone though.
authormartin <martin>
Thu, 1 Aug 2002 07:09:39 +0000 (07:09 +0000)
committermartin <martin>
Thu, 1 Aug 2002 07:09:39 +0000 (07:09 +0000)
Also, make the "realuser" the teacher's id, in case we want to use it later

course/loginas.php

index 52f161e4829e396acf481404f84b586a6aa04b8a..febaf7f866cab29957e93a2372dd3bfc79577672 100644 (file)
     // Login as this student and return to course home page.
 
     $teacher_name = "$USER->firstname $USER->lastname";
+    $teacher_id   = "$USER->id";
 
     $USER = get_user_info_from_db("id", $user);
     $USER->loggedin = true;
-    $USER->realuser = $teacher_name;
-
     set_moodle_cookie($USER->username);
-
     $student_name = "$USER->firstname $USER->lastname";
-    
-    add_to_log($course->id, "course", "loginas", "../user/view.php?id=$course->id&user=$user", "$teacher_name");
+
+    add_to_log($course->id, "course", "loginas", "../user/view.php?id=$course->id&user=$user", "$teacher_name -> $student_name");
+
+    $USER->realuser = $teacher_id;
 
     notice("You are now logged in as $student_name", "$CFG->wwwroot/course/view.php?id=$course->id");