diff --git a/src/transformer/events/core/user_enrolment_created.php b/src/transformer/events/core/user_enrolment_created.php index 1ccee4ace..5bed80134 100644 --- a/src/transformer/events/core/user_enrolment_created.php +++ b/src/transformer/events/core/user_enrolment_created.php @@ -22,7 +22,7 @@ function user_enrolment_created(array $config, \stdClass $event) { $repo = $config['repo']; - $user = $repo->read_record_by_id('user', $event->userid); + $user = $repo->read_record_by_id('user', $event->relateduserid); $course = $repo->read_record_by_id('course', $event->courseid); $lang = utils\get_course_lang($course); diff --git a/tests/core/user_enrolment_created/existing_user_enrolled/event.json b/tests/core/user_enrolment_created/existing_user_enrolled/event.json index 5488be97e..5f0c1129b 100644 --- a/tests/core/user_enrolment_created/existing_user_enrolled/event.json +++ b/tests/core/user_enrolment_created/existing_user_enrolled/event.json @@ -1,6 +1,6 @@ { "id": 1, - "userid": 1, + "relateduserid": 1, "courseid": 1, "timecreated": 1433946701, "objecttable": "user",