relateduserid; $courseid = $event->courseid; $completion = new \completion_info($event->get_course()); if (!$completion->is_enabled()) { return; } $completion->update_state(); \core\notification::add("Course completion status updated for user $userid in course $courseid.", \core\output\notification::NOTIFY_SUCCESS); } }