From a5daf57cdc1b72f9e4e9dc66224246c70eedce27 Mon Sep 17 00:00:00 2001
From: moodler <moodler>
Date: Fri, 21 May 2004 15:10:47 +0000
Subject: [PATCH] Remember timeaccess settings even after returning from
 logging as another person

---
 course/loginas.php | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/course/loginas.php b/course/loginas.php
index 58e51d6a5b..246003aa16 100644
--- a/course/loginas.php
+++ b/course/loginas.php
@@ -25,6 +25,10 @@
             $SESSION->currentgroup[$course->id] = $SESSION->oldcurrentgroup;
             unset($SESSION->oldcurrentgroup);
         }
+        if (isset($SESSION->oldtimeaccess)) {        // Restore previous timeaccess settings
+            $USER->timeaccess = $SESSION->oldtimeaccess;
+            unset($SESSION->oldtimeaccess);
+        }
 
         redirect($_SERVER["HTTP_REFERER"]);
         exit;
@@ -44,6 +48,12 @@
         error("You can not login as this person!");
     }
 
+    // Remember current timeaccess settings for later
+
+    if (isset($USER->timeaccess)) {
+        $SESSION->oldtimeaccess = $USER->timeaccess;
+    }
+
     // Login as this student and return to course home page.
 
     $teacher_name = fullname($USER, true);
-- 
2.39.5