Event fireing problem with LDAP sync and profile based cohort membership plugins

Event fireing problem with LDAP sync and profile based cohort membership plugins

by Zoran Jančić -
Number of replies: 1
Picture of Particularly helpful Moodlers

Hi

I'm trying to figure out why Profile field based cohort membership is not detecting \core\event\user_created event when user is created via  auth_ldap\task\sync_task. There is the following record in the logs: The user with id 'x' created the user with id 'y'. I'm also notified by the event monitoring that the new user is created. But the profile field based cohort membership rule is not applied even though the plugin listens to the event \core\event\user_created. 

What is interesting is that the Profile field based cohort membership is detecting \core\event\user_created event when user is created in any other way. Even if LDAP user logs in to the system for the first time and his Moodle account gets created by LDAP plugin, it detects the event. 
What is even more interesting is that it also detects \core\event\user_updated when user gets updated in any way, even if it is updated via auth_ldap\task\sync_task. 

So, I'm trying to figure out if the  \core\event\user_created event is not fired properly by the auth_ldap\task\sync_task script or the Profile field based cohort membership plugin is not detecting the event properly. 

Any help or guidline would be appreceated.

Kind regards

Average of ratings: -
In reply to Zoran Jančić

Re: Event fireing problem with LDAP sync and profile based cohort membership plugins

by Neill Magill -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
A good first step might be to check if the event is being monitored by your plugin as you expect.

  1. Go to <your-site>/report/eventlist/index.php
  2. Find the event you want to look at and follow the link
  3. The page should show Plugins observing this event
If your plugin is not listed there make sure it is setup correctly and that you did a version bump to get your plugin to upgrade and register the rule.