Permalink
Browse files

Updated guest shortcut code with Mike's loginas fixes

  • Loading branch information...
fiedorow
fiedorow committed Feb 19, 2005
1 parent 079cf26 commit 5f357fb67be8201a39f8b66aa82086786f028711
Showing with 9 additions and 7 deletions.
  1. +5 −4 course/enrol.php
  2. +4 −3 lib/moodlelib.php
View
@@ -72,10 +72,11 @@
$USER->loggedin = true;
$USER->site = $CFG->wwwroot;
$USER->realuser = $realuser;
- if (isset($SESSION->currentgroup[$course->id])) { // Remember current setting for later
- $SESSION->oldcurrentgroup = $SESSION->currentgroup[$course->id];
- unset($SESSION->currentgroup[$course->id]);
- }
+ $USER->sessionIP = md5(getremoteaddr()); // Store the current IP in the session
+ if (isset($SESSION->currentgroup)) { // Remember current cache setting for later
+ $SESSION->oldcurrentgroup = $SESSION->currentgroup;
+ unset($SESSION->currentgroup);
+ }
$guest_name = fullname($USER, true);
add_to_log($course->id, "course", "loginas", "../user/view.php?id=$course->id&$USER->id$", "$realname -> $guest_name");
if ($SESSION->wantsurl) {
View
@@ -1171,9 +1171,10 @@ function require_login($courseid=0, $autologinguest=true, $cm=null) {
$USER->loggedin = true;
$USER->site = $CFG->wwwroot;
$USER->realuser = $realuser;
- if (isset($SESSION->currentgroup[$course->id])) { // Remember current setting for later
- $SESSION->oldcurrentgroup = $SESSION->currentgroup[$course->id];
- unset($SESSION->currentgroup[$course->id]);
+ $USER->sessionIP = md5(getremoteaddr()); // Store the current IP in the session
+ if (isset($SESSION->currentgroup)) { // Remember current cache setting for later
+ $SESSION->oldcurrentgroup = $SESSION->currentgroup;
+ unset($SESSION->currentgroup);
}
$guest_name = fullname($USER, true);
add_to_log($course->id, "course", "loginas", "../user/view.php?id=$course->id&$USER->id$", "$realname -> $guest_name");

0 comments on commit 5f357fb

Please sign in to comment.