Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-39282 quiz: always allow removal of bogus questions.

  • Loading branch information...
commit 97f7bfc45751dc5b14e1c9c6f17280b30b022e4c 1 parent 19075a2
@timhunt timhunt authored
Showing with 5 additions and 2 deletions.
  1. +5 −2 mod/quiz/edit.php
View
7 mod/quiz/edit.php
@@ -277,8 +277,11 @@ function module_specific_controls($totalnumber, $recurse, $category, $cmid, $cmo
if ($remove && confirm_sesskey()) {
// Remove a question from the quiz.
// We require the user to have the 'use' capability on the question,
- // so that then can add it back if they remove the wrong one by mistake.
- quiz_require_question_use($remove);
+ // so that then can add it back if they remove the wrong one by mistake,
+ // but, if the question is missing, it can always be removed.
+ if ($DB->record_exists('question', array('id' => $remove))) {
+ quiz_require_question_use($remove);
+ }
quiz_remove_question($quiz, $remove);
quiz_delete_previews($quiz);
quiz_update_sumgrades($quiz);
Please sign in to comment.
Something went wrong with that request. Please try again.