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.