General developer forum

Picture of HJWUCGA INC.
Trigger to unenrol students that were database enrolled


I was following this thread -

The thread mentions the difficulty or non-existent method of unenrolling students manually if they were originally enrolled through database enrolment.

I got around it by writing a query to delete them but it's not ideal.

In the thread, it mentioned creating a special role and his script scans the table for those users with that special role and unenrols them from the course via a scheduled script.

I was thinking of doing something similar but using a trigger. The trigger would automatically unenrol that user from the course when the administrator or instructor adds this add special role to the user.

Does this make sense? How would I go about to do this?




Average of ratings: -
Picture of HJWUCGA INC.
Re: Trigger to unenrol students that were database enrolled

still trying to figure this out?

Is this impossible to do? Or is this a "bug" in Moodle 2.x+ that we can't manually unenrol users through database or LDAP enrolment without the need to going to the database directly and deleting the enrolments?

Average of ratings: -