After reading the documentation on Moodle Events (https://docs.moodle.org/dev/Event_2) I have a simple question about them which I'm guessing somebody could quickly confirm that my understand is correct (before I go ahead and test it).
I have an existing plugin which through an overnight cron job, takes all the data in mdl_user_info_data and normalises it into a new table, where every additional profile field is a column in the table (called userdata)
I'm now looking to improve this plugin to make the updates to my plugin table instant, rather than wait for the overnight cron job. From my understanding of the Events this should be possible by:
- adding a file db/events.php to my plugin
- listen for core/event/user_updated within the $observers array and call my custom function (defined within the callback param). My custom function would update my userdata table when a user profile is updated.
- I could also 'observe' other events such as user_created and user_deleted to do other things on my custom table.
Is my understanding correct and do other authentication methods trigger the same events, for example if a user is created via LDAP authentication would it trigger the same user_created event?
Thanks in advance