MDL-45319 events: set the relateduserid when triggering the user_created/updated...
authorMark Nelson <markn@moodle.com>
Wed, 7 May 2014 05:50:51 +0000 (22:50 -0700)
committerMarina Glancy <marina@moodle.com>
Wed, 7 May 2014 08:28:59 +0000 (16:28 +0800)
lib/moodlelib.php
user/lib.php

index f736531..36dfc72 100644 (file)
@@ -4283,6 +4283,7 @@ function delete_user(stdClass $user) {
     $event = \core\event\user_deleted::create(
             array(
                 'objectid' => $user->id,
+                'relateduserid' => $user->id,
                 'context' => $usercontext,
                 'other' => array(
                     'username' => $user->username,
@@ -4733,8 +4734,9 @@ function update_internal_user_password($user, $password) {
 
         // Trigger event.
         $event = \core\event\user_updated::create(array(
-             'objectid' => $user->id,
-             'context' => context_user::instance($user->id)
+            'objectid' => $user->id,
+            'relateduserid' => $user->id,
+            'context' => context_user::instance($user->id)
         ));
         $event->add_record_snapshot('user', $user);
         $event->trigger();
@@ -5972,6 +5974,7 @@ function setnew_password_and_mail($user, $fasthash = false) {
     // Trigger event.
     $event = \core\event\user_updated::create(array(
         'objectid' => $user->id,
+        'relateduserid' => $user->id,
         'context' => context_user::instance($user->id)
     ));
     $event->add_record_snapshot('user', $user);
index 6152538..aee893b 100644 (file)
@@ -91,6 +91,7 @@ function user_create_user($user, $updatepassword = true) {
     $event = \core\event\user_created::create(
             array(
                 'objectid' => $newuserid,
+                'relateduserid' => $newuserid,
                 'context' => $usercontext
                 )
             );
@@ -169,6 +170,7 @@ function user_update_user($user, $updatepassword = true) {
     $event = \core\event\user_updated::create(
             array(
                 'objectid' => $user->id,
+                'relateduserid' => $user->id,
                 'context' => context_user::instance($user->id)
                 )
             );