Permalink
Browse files

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

  • Loading branch information...
1 parent 215c189 commit 106269b39375921302cec59828c68e36ce637bad @timhunt timhunt committed Mar 1, 2013
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);

0 comments on commit 106269b

Please sign in to comment.