diff --git a/classes/local/tool_dynamic_cohorts/condition/cohort_field.php b/classes/local/tool_dynamic_cohorts/condition/cohort_field.php index 239cd4e..f34a390 100644 --- a/classes/local/tool_dynamic_cohorts/condition/cohort_field.php +++ b/classes/local/tool_dynamic_cohorts/condition/cohort_field.php @@ -491,7 +491,6 @@ public function get_sql(): condition_sql { */ public function get_events(): array { return [ - '\core\event\cohort_updated', '\core\event\cohort_member_added', '\core\event\cohort_member_removed', ]; diff --git a/classes/observer.php b/classes/observer.php index 5b6692c..161555b 100644 --- a/classes/observer.php +++ b/classes/observer.php @@ -17,7 +17,6 @@ namespace tool_dynamic_cohorts; use core\event\base; -use tool_dynamic_cohorts\rule_manager; /** * Event observer class. @@ -50,7 +49,7 @@ public static function process_event(base $event): void { protected static function get_userid_from_event(base $event): int { $data = $event->get_data(); - if (array_key_exists('relateduserid', $data)) { + if (array_key_exists('relateduserid', $data) && !empty($data['relateduserid'])) { $userid = $data['relateduserid']; } else { $userid = $data['userid'];