diff --git a/local/o365/classes/page/acp.php b/local/o365/classes/page/acp.php index 7d41d1f20..894163351 100644 --- a/local/o365/classes/page/acp.php +++ b/local/o365/classes/page/acp.php @@ -1432,10 +1432,12 @@ public function mode_maintenance_resyncgroupusers() { $sql .= ' AND crs.id = ?'; $params[] = $courseid; } - if (is_array($coursesenabled)) { + if (is_array($coursesenabled) && !empty($coursesenabled)) { [$coursesinsql, $coursesparams] = $DB->get_in_or_equal($coursesenabled); $sql .= ' AND crs.id ' . $coursesinsql; $params = array_merge($params, $coursesparams); + } else { + $sql .= ' AND 1 = 0'; } $courses = $DB->get_recordset_sql($sql, $params); $outputsbycourse = [];