From: mjollnir_ Date: Thu, 27 Jan 2005 02:29:53 +0000 (+0000) Subject: Fix for add_to_log to stop notification of invalid call to isteacher. Some actions... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=e3a232138a361d2d7bc745df712f09bac7a3596e;p=moodle.git Fix for add_to_log to stop notification of invalid call to isteacher. Some actions aren't associated with a course and therefore isteacher shouldn't get called --- diff --git a/lib/datalib.php b/lib/datalib.php index abb757a43f..a30e674e12 100644 --- a/lib/datalib.php +++ b/lib/datalib.php @@ -2663,7 +2663,7 @@ function add_to_log($courseid, $module, $action, $url='', $info='', $cm=0, $user if (!$user and isset($USER->id)) { $db->Execute('UPDATE '. $CFG->prefix .'user SET lastIP=\''. $REMOTE_ADDR .'\', lastaccess=\''. $timenow .'\' WHERE id = \''. $USER->id .'\' '); - if ($courseid != SITEID) { + if ($courseid != SITEID && !empty($courseid)) { // logins etc dont't have a courseid and isteacher will break without it. if (isstudent($courseid)) { $db->Execute('UPDATE '. $CFG->prefix .'user_students SET timeaccess = \''. $timenow .'\' '. 'WHERE course = \''. $courseid .'\' AND userid = \''. $userid .'\'');