Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-25700

The mod_deleted trigger is not triggered on AJAX requests

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: None
    • Component/s: Course
    • Labels:
      None
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_20_STABLE

      Description

      When deleting a resource from a topic using AJAX, the event mod_deleted is not triggered.

      To resolve this bug the following lines can be added to the file [moodle_root]/course/rest.php, within the case 'DELETE' on the bottom of subcase 'resource' just before the add_to_log($courseid, "course", "delete mod", "view.php?id=$courseid", "$cm->modname $cm->instance", $cm->id); line:

      // Trigger a mod_deleted event with information about this module.
      $eventdata = new stdClass();
      $eventdata->modulename = $cm->modname;
      $eventdata->cmid = $cm->id;
      $eventdata->courseid = $course->id;
      $eventdata->userid = $USER->id;

      events_trigger('mod_deleted', $eventdata);

      Thanks

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                moodle.com moodle.com
                Reporter:
                cesperanc@ Cláudio Esperança
                Participants:
                Component watchers:
                Amaia Anabitarte, Bas Brands, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                1 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: