I want to prevent certain users based on their course roles from being able to delete certain activity modules based on tags on the activity module.
Let me give you an example - Admin/ course creator creates a bunch of common quizzes for everyone enrolled in a course. Each teacher wants to create an assignment visible only for their group which they can. They should be able to able to delete these if need be. However, they shouldn't be able to delete the modules created by the admin. This is similar to the delete your ownquestion vs delete all questions type capability. Unfortunately it doesnt exist in the context of activities. So far what I have is I realized the delete button calls ../moodle/course/mod.php and passes a sessionkey with the delete=id info. I tried to write an if condition within mod.php but it doesn't work for some reason. Oddly enough I think it uses a cache'd version of the function sometimes that deletes happen even if I comment out the course_delete_module($cm->id) script.