Skip to content

Commit

Permalink
MDL-45319 events: set the relateduserid when triggering the user_crea…
Browse files Browse the repository at this point in the history
…ted/updated/deleted events
  • Loading branch information
mdjnelson authored and marinaglancy committed May 7, 2014
1 parent e687396 commit f1e0f66
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/moodlelib.php
Expand Up @@ -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,
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions user/lib.php
Expand Up @@ -91,6 +91,7 @@ function user_create_user($user, $updatepassword = true) {
$event = \core\event\user_created::create(
array(
'objectid' => $newuserid,
'relateduserid' => $newuserid,
'context' => $usercontext
)
);
Expand Down Expand Up @@ -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)
)
);
Expand Down

0 comments on commit f1e0f66

Please sign in to comment.