From df116afee53d366c27d056e429e7422e91b0543e Mon Sep 17 00:00:00 2001 From: Matthew Hilton Date: Thu, 4 Apr 2024 13:34:14 +1000 Subject: [PATCH] [#157] Fix quiz compatibility in newer versions of Moodle --- classes/form/quiz_override_form.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/classes/form/quiz_override_form.php b/classes/form/quiz_override_form.php index d35fd935..223330ac 100644 --- a/classes/form/quiz_override_form.php +++ b/classes/form/quiz_override_form.php @@ -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'); /** @@ -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); }