CRUD events for standard modules

CRUD events for standard modules

by Daniel Neis Araujo -
Number of replies: 0
Picture of Core developers Picture of Plugin developers Picture of Translators

Hello,


sometime ago I've started developing a "Max views" availability condition for Moodle.

This availability condition relies on the events triggered by the plugins, so it would count all "read" events (events which the "crud" field is equal "r") for a given context and user and then tell if the user had reached the limit or still can see the course module instance.

You can see the test on the following URL: https://github.com/danielneis/moodle-availability_maxviews/blob/master/classes/condition.php#L88-L103

But for some reason, it only worked for Page and File resources and not for the other plugins, as you can see on the behat tests: https://github.com/danielneis/moodle-availability_maxviews/blob/master/tests/behat/availability_maxviews.feature and on this build from travis ci : https://travis-ci.org/danielneis/moodle-availability_maxviews/jobs/105031797

I've checked the standard plugins and it seems that all have the course_module_viewed event class and I think they are being correctly triggered (but not checked all of them, only a few).

So, am I doing anything wrong? Any suggestions of better approaches?


Kind regards,

Daniel


Average of ratings: -