General developer forum

Help with: Enrol Plugin w/ Future Start Date + Email Notifications

Picture of Jer Brand
Help with: Enrol Plugin w/ Future Start Date + Email Notifications

That subject is a bit of a mouth-full, but here's the gist.

I've created a plugin (Moodle 3.2/Totara9.x) that observes \core\event\course_completed checks to see if the course that was completed has a matching entry in enrol and then enrolls a user in the another course.  In addition, the plugin allows for a delay (in days) before the enrollment is made active. It does this by using the $timestart parameter of enrol_get_plugins::enrol_user().

This all works as expected. 

Now I need a way of notifying the user when the course becomes active for each individual user (as they will not all take the first course at the same time). My guess is that there's some Moodle process that's making the course visible via cron -- only my search-fu is not turning anything up. I've been running with the assumption that if I could find that process and if that process has some distinct event I could observe it. Hopefully it's not not using core\event\user_enrolment_created as that event appears to be fired during the call to enrol_get_plugins::enrol_user().

Anyone have a guess at where I might find this cron process that updates enrollments for Moodle itself or if I'm chasing my tail and should just build my own custom tables + cron task?

Average of ratings: -