Skip to content

Commit

Permalink
Fix: remove courses with ID 0 form enrolment
Browse files Browse the repository at this point in the history
  • Loading branch information
davidszkiba committed Jan 23, 2024
1 parent 2b7bcb8 commit 755bacb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions classes/catquiz.php
Original file line number Diff line number Diff line change
Expand Up @@ -1674,8 +1674,8 @@ public static function enrol_user(
$coursestoenrol = $quizsettings['catquiz_courses_' . $catscaleid . '_' . $i] ?? [];
// The first element at array key 0 is a dummy value to
// display some message like "please select course" in the
// form.
unset($coursestoenrol['0']);
// form and has a course ID of 0.
$coursestoenrol = array_filter($coursestoenrol, fn ($v) => $v != 0);
foreach ($coursestoenrol as $courseid) {
$context = \context_course::instance($courseid);
$course = get_course($courseid);
Expand Down

0 comments on commit 755bacb

Please sign in to comment.