From 99627fb3d143c5d60d3c326247376e3b1d3175a2 Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Sun, 18 May 2014 20:54:13 -0700 Subject: [PATCH] MDL-45607 events: changed the context passed to the user_profile_viewed event --- lib/classes/event/user_profile_viewed.php | 8 ++++---- user/view.php | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/classes/event/user_profile_viewed.php b/lib/classes/event/user_profile_viewed.php index 12eb8782241..de886281dc1 100644 --- a/lib/classes/event/user_profile_viewed.php +++ b/lib/classes/event/user_profile_viewed.php @@ -69,7 +69,7 @@ class user_profile_viewed extends base { */ public function get_description() { return "The user with id '$this->userid' viewed the profile for the user with id '$this->relateduserid' in the course " . - "with id '{$this->other['courseid']}'."; + "with id '$this->courseid'."; } /** @@ -78,7 +78,7 @@ class user_profile_viewed extends base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/user/view.php', array('id' => $this->relateduserid, 'course' => $this->other['courseid'])); + return new \moodle_url('/user/view.php', array('id' => $this->relateduserid, 'course' => $this->courseid)); } /** @@ -87,7 +87,7 @@ class user_profile_viewed extends base { * @return array */ protected function get_legacy_logdata() { - return array($this->other['courseid'], 'user', 'view', 'view.php?id=' . $this->relateduserid . '&course=' . - $this->other['courseid'], $this->relateduserid); + return array($this->courseid, 'user', 'view', 'view.php?id=' . $this->relateduserid . '&course=' . + $this->courseid, $this->relateduserid); } } diff --git a/user/view.php b/user/view.php index 2e008750b26..900f1fa2cf1 100644 --- a/user/view.php +++ b/user/view.php @@ -192,7 +192,8 @@ if ($user->deleted) { $event = \core\event\user_profile_viewed::create(array( 'objectid' => $USER->id, 'relateduserid' => $user->id, - 'context' => $usercontext, + 'courseid' => $course->id, + 'context' => $coursecontext, 'other' => array( 'courseid' => $course->id, 'courseshortname' => $course->shortname,