return false;
}
+ // Keep user record before updating it, as we have to pass this to user_deleted event.
+ $olduser = clone $user;
+
// Keep a copy of user context, we need it for event.
$usercontext = context_user::instance($user->id);
array(
'objectid' => $user->id,
'context' => $usercontext,
- 'other' => array('user' => (array)clone $user)
+ 'other' => array(
+ 'username' => $user->username,
+ 'email' => $user->email,
+ 'idnumber' => $user->idnumber,
+ 'picture' => $user->picture,
+ 'mnethostid' => $user->mnethostid
+ )
)
);
- $event->add_record_snapshot('user', $updateuser);
+ $event->add_record_snapshot('user', $olduser);
$event->trigger();
// We will update the user's timemodified, as it will be passed to the user_deleted event, which
$SESSION->justloggedin = true;
unset($SESSION->lang);
+ unset($SESSION->load_navigation_admin);
}
// Delete the course and related context instance.
context_helper::delete_instance(CONTEXT_COURSE, $courseid);
- // We will update the course's timemodified, as it will be passed to the course_deleted event,
- // which should know about this updated property, as this event is meant to pass the full course record.
- $course->timemodified = time();
-
$DB->delete_records("course", array("id" => $courseid));
$DB->delete_records("course_format_options", array("courseid" => $courseid));
$event = \core\event\course_deleted::create(array(
'objectid' => $course->id,
'context' => $context,
- 'other' => array('shortname' => $course->shortname,
- 'fullname' => $course->fullname)
+ 'other' => array(
+ 'shortname' => $course->shortname,
+ 'fullname' => $course->fullname,
+ 'idnumber' => $course->idnumber
+ )
));
$event->add_record_snapshot('course', $course);
$event->trigger();