From: gustav_delius Date: Sun, 29 Aug 2004 11:41:55 +0000 (+0000) Subject: add_to_log now updates lastaccess if used on site. See bug 1821 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=540995b8014f9d47b4c2782a939ef1e8493105c9;p=moodle.git add_to_log now updates lastaccess if used on site. See bug 1821 --- diff --git a/lib/datalib.php b/lib/datalib.php index 2c530787a8..9beec5446d 100644 --- a/lib/datalib.php +++ b/lib/datalib.php @@ -2278,13 +2278,14 @@ function add_to_log($courseid, $module, $action, $url="", $info="", $cm=0, $user if (!$result and ($CFG->debug > 7)) { echo "

Error: Could not insert a new entry to the Moodle log

"; // Don't throw an error } - if (!$user) { - if (isstudent($courseid)) { + if (!$user and isset($USER->id)) { + $site = get_site(); + if ($courseid == $site->id) { + update_user_in_db(); + } else if (isstudent($courseid)) { $db->Execute("UPDATE {$CFG->prefix}user_students SET timeaccess = '$timenow' ". "WHERE course = '$courseid' AND userid = '$userid'"); - } - - if (isteacher($courseid, false, false)) { + } else if (isteacher($courseid, false, false)) { $db->Execute("UPDATE {$CFG->prefix}user_teachers SET timeaccess = '$timenow' ". "WHERE course = '$courseid' AND userid = '$userid'"); }