Skip to content

Commit

Permalink
Merge pull request #158 from catalyst/157-fix-compatibility-with-quiz
Browse files Browse the repository at this point in the history
Fix quiz compatibility with backported MDL-80300
  • Loading branch information
tuanngocnguyen authored Apr 4, 2024
2 parents 1b9dd43 + df116af commit 719ab0d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions classes/form/quiz_override_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
defined('MOODLE_INTERNAL') || die();

require_once("$CFG->libdir/formslib.php");

// Note - in Moodle 4.2+ this has moved, but this will still link
// because of the db/renamedclasses.php linking.
require_once($CFG->dirroot . '/mod/quiz/override_form.php');

/**
Expand Down Expand Up @@ -54,6 +57,11 @@ public function __construct($cm, $quiz, $context, $override, $submitteddata = nu
$this->groupid = 0;
$this->userid = empty($override->userid) ? 0 : $override->userid;

// Required if MDL-80300 is backported (in core 4.4+).
if (property_exists($this, 'overrideid')) {
$this->overrideid = $override->id ?? 0;
}

\moodleform::__construct(null, null, 'post', '', ['class' => 'ignoredirty'], true, $submitteddata);
}

Expand Down

0 comments on commit 719ab0d

Please sign in to comment.