add_to_log() - fixed a postgres support bug when is set to '', and clarified the logic that decides whether to update the user_students/user_teacher records.
This commit is contained in:
+5
-1
@@ -2383,6 +2383,10 @@ function add_to_log($courseid, $module, $action, $url="", $info="", $cm=0, $user
|
||||
|
||||
global $db, $CFG, $USER, $REMOTE_ADDR;
|
||||
|
||||
if ($cm === '') { // postgres won't translate empty string to its default
|
||||
$cm = 0;
|
||||
}
|
||||
|
||||
if ($user) {
|
||||
$userid = $user;
|
||||
} else {
|
||||
@@ -2401,7 +2405,7 @@ function add_to_log($courseid, $module, $action, $url="", $info="", $cm=0, $user
|
||||
if (!$result and ($CFG->debug > 7)) {
|
||||
echo "<P>Error: Could not insert a new entry to the Moodle log</P>"; // Don't throw an error
|
||||
}
|
||||
if (!$user and isset($USER->id)) {
|
||||
if ( isset($USER) && (empty($user) || $user==$USER->id) ) {
|
||||
if ($courseid == 1) {
|
||||
update_user_in_db();
|
||||
} else if (isstudent($courseid)) {
|
||||
|
||||
Reference in New Issue
Block a user