Affects Version/s: 3.3.2
Fix Version/s: None
Component/s: Events API
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.
- 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....