diff --git a/mod/quiz/processattempt.php b/mod/quiz/processattempt.php index 50dba84d6ee7c..bd15d5642ae9d 100644 --- a/mod/quiz/processattempt.php +++ b/mod/quiz/processattempt.php @@ -85,6 +85,12 @@ 'attemptalreadyclosed', null, $attemptobj->review_url()); } +// If this page cannot be accessed, notify user and send them to the correct page. +if (!$finishattempt && !$attemptobj->check_page_access($thispage)) { + throw new moodle_exception('submissionoutofsequencefriendlymessage', 'question', + $attemptobj->attempt_url(null, $attemptobj->get_currentpage())); +} + // Process the attempt, getting the new status for the attempt. $status = $attemptobj->process_attempt($timenow, $finishattempt, $timeup, $thispage);