30 September 2019
As our technical team works on Moodle, we find ourselves tackling issues that may be of interest to other developers. As a part of the Moodle community and advocators of openness, we decided to share our own experiences from Moodle Dev, among other things of course! If you haven’t read our previous post, take a look at “The Antivirus MIME Blocker”
What is Moodle event monitoring?
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.
Categorisation of event monitoring
We can categorise Moodle events into to two parts:
1.Existing events in core
2. Custom events by event API
Existing events in core
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
Create event monitoring rule for existing events
Enable event monitoring
An administrator can enable it from Site administration > Reports > Event monitoring rules.
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
- Click on ‘Add new rule’
- Add necessary information such ad Rule name, Area to monitor such as 'core' & event name such as 'User has logged in'
- Click on ‘Save changes’ button
- Now go to ‘Event monitoring page’
- Select a course ‘Site’
- Click on plus + sign for subscribe
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.
- Go to Site administration > Users > Define roles and click edit icon for student role.
- Allow ‘tool/monitor:subscribe’ capability to student role.
- Now student can subscribe created event via the user menu Preferences > Event monitoring.
Custom Events by event API
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
Also interesting in this category...
Reflection on OECD Report: Innovating Education and Educating for Innovation11 October 2019
Moodle Workplace: New kid on the block!7 October 2019
Why do teachers love Moodle?2 October 2019
Stories from Moodle Dev: Moodle Event Monitoring30 September 2019
Stories from Moodle Dev: The Antivirus MIME Blocker26 September 2019
Reflection on World Bank Group Report: Learning to Realise Education’s Potential24 September 2019
Stories from Moodle Dev: The Tale of the User with no Email24 September 2019
Eummena is now a certified Moodle Partner3 September 2019
Eummena in the 1st Palestine Creative AI Week1 August 2019
Eummena has a new website20 May 2019
OECD Skills Outlook 2019 Report14 May 2019
PISA redefining testing standards9 May 2019
Eummena @BETT 201920 December 2018