Sometimes we need updates on the basis of some actions in an email. Such actions are related to who has logged in to the site, what manipulation is going on, on the site such as adding/deleting/viewing any activity, submission of assignment etc. Moodle provides action based notification system ‘Event monitoring’ to keep user updated for any action happens in the LMS.
Event monitoring allows admins and teachers to receive notifications when certain events happen in Moodle such as user logged in, user created, quiz creation & quiz submission etc. Any role that has tool/monitor:subscribe
can subscribe to the event. By default, this is only for admin, manager and teachers.
Before version 2.7, Moodle used simple logging API to log any action in the database, these actions were then displayed on log report and live log reports. We can’t receive any notification of action performed through logging API. In Moodle 2.8, Moodle introduced ‘Event monitoring system’ that is used to add all logs into a database as well as we to receive email notifications.
We can categorise Moodle events into to two parts:
1.Existing events in core
2. Custom events by event API
The Moodle event system contains multiple built-in actions for notifications such as “view module”, “role assign”, “user created” etc. We can see the list of available events from Moodle documentation https://docs.moodle.org/dev/Event_2#Existing_events
Enable event monitoring
An administrator can enable it from Site administration > Reports > Event monitoring rules.
Create rule
The first step is to create the rule to be monitored then a user such admin and teacher can subscribe on created event.
A teacher can create a rule from Course administration > Reports > Event monitoring rules
The administrator can, additionally, create a rule from Site administration > Reports > Event monitoring rules
By default, students get notification that are show in User menu > Preferences > Notification (configuration needed by administrator), there are lot of events created for monitoring in which a student can also subscribe to events that will be created by administrator or teachers. The administrator will allow access to students so that they can subscribe in the event. Below are the steps that have to be followed in order to allow student to get notification of any event.
Moodle provides event API which can be added in plugin, so we can create custom event within a plugin and once event triggered notification will be generated. Below is the overview how can we implement event API to our plugin.
Moodle provides detailed documentation which describe how to implement event API into your plugin.
Below you may find some screenshots that depict the actions explained throughout this post.
View event list
Enable Event Monitoring
Add new rule
Subscribe to the rule
Story by: Azmat Ullah, Eummena