Moodle

Question bank - Action - Delete does not work

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.9, 2.0
  • Fix Version/s: 1.9.2
  • Component/s: Questions
  • Labels:
    None
  • Affected Branches:
    MOODLE_19_STABLE, MOODLE_20_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE

Description

Question bank - Action - Delete icon does not work.
The only way to delete a question is to tick the Action/Select box and then the With Selected/Delete button.
Joseph

Issue Links

Activity

Hide
Pierre Pichet added a comment -

Effectively the only delete process that remains in question_showbank_actions (editlib.php) is the one related to the select button.
The url form the delete X
http://132.208.141.198/moodle_19/mod/quiz/edit.php?recurse=1&qpage=0&cat=2%2C8&cmid=5&deleteselected=1&q1=1

if (optional_param('deleteselected', false, PARAM_BOOL)) { // delete selected questions from the category
if (($confirm = optional_param('confirm', '', PARAM_ALPHANUM)) and confirm_sesskey()) { // teacher has already confirmed the action
$deleteselected = required_param('deleteselected');
if ($confirm == md5($deleteselected)) {
if ($questionlist = explode(',', $deleteselected)) {
// for each question either hide it if it is in use or delete it
foreach ($questionlist as $questionid) {
question_require_capability_on($questionid, 'edit');
if (record_exists('quiz_question_instances', 'question', $questionid)) {
if (!set_field('question', 'hidden', 1, 'id', $questionid)) { question_require_capability_on($questionid, 'edit'); error('Was not able to hide question'); }
} else { delete_question($questionid); }
}
}
redirect($pageurl->out());
} else { error("Confirmation string was incorrect"); }
}
}
The url should be changed to go to the confirm first as this question could be used in a quiz.

Tim, if you want that I continue on this, just reassign it.

Show
Pierre Pichet added a comment - Effectively the only delete process that remains in question_showbank_actions (editlib.php) is the one related to the select button. The url form the delete X http://132.208.141.198/moodle_19/mod/quiz/edit.php?recurse=1&qpage=0&cat=2%2C8&cmid=5&deleteselected=1&q1=1 if (optional_param('deleteselected', false, PARAM_BOOL)) { // delete selected questions from the category if (($confirm = optional_param('confirm', '', PARAM_ALPHANUM)) and confirm_sesskey()) { // teacher has already confirmed the action $deleteselected = required_param('deleteselected'); if ($confirm == md5($deleteselected)) { if ($questionlist = explode(',', $deleteselected)) { // for each question either hide it if it is in use or delete it foreach ($questionlist as $questionid) { question_require_capability_on($questionid, 'edit'); if (record_exists('quiz_question_instances', 'question', $questionid)) { if (!set_field('question', 'hidden', 1, 'id', $questionid)) { question_require_capability_on($questionid, 'edit'); error('Was not able to hide question'); } } else { delete_question($questionid); } } } redirect($pageurl->out()); } else { error("Confirmation string was incorrect"); } } } The url should be changed to go to the confirm first as this question could be used in a quiz. Tim, if you want that I continue on this, just reassign it.
Hide
Tim Hunt added a comment -

I must have broken this with my changes done as part of MDL-13982. I'll fix it, hopefully tomorrow.

Show
Tim Hunt added a comment - I must have broken this with my changes done as part of MDL-13982. I'll fix it, hopefully tomorrow.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: