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

Trigger events before actions

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.3.2
    • Fix Version/s: None
    • Component/s: Events API
    • Labels:
      None
    • Affected Branches:
      MOODLE_33_STABLE

      Description

      I would like to have a way to execute some plugin code before deleting a course.

      Looking at the verb in Event 2 documentation, I only see verbs for actions already done.

       

      Explanation:

      • our Moodle is connected to our administration system
      • when you try to delete a course in Moodle, it should check first that the course is not connected to a course in the administration system, and give an error if that's the case, not deleting the course

       

      I have been searching and looking at Moodle code, but only similar thing I could find is: pre_course_delete

      This does not work for me, because it is executed after course deletion have started: grades and other stuff is deleted before calling this.

      Also, you cannot prevent course deletion, as the function will be executed, but course deletion will continue after it finishes.

       

      Ideally, there would be events like before_course_delete or similar, but it seems all are post-process functions.

      Other useful "before" events could include before_user_update, before_user_delete....

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              aduranterres Antonio Duran
              Participants:
              Component watchers:
              Jake Dallimore, Jun Pataleta, Ryan Wyllie
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: