From 4a9dcf3f179335c149bc7be17d2425f1e14b9d5d 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 1d19c48128e45..5756c15fe2253 100644 --- a/lib/classes/event/user_profile_viewed.php +++ b/lib/classes/event/user_profile_viewed.php @@ -54,7 +54,7 @@ public static function get_name() { */ public function get_description() { return 'User ' . $this->userid . ' viewed the profile for user ' . $this->relateduserid . ' in the course ' . - $this->other['courseid']; + $this->courseid; } /** @@ -63,7 +63,7 @@ public function get_description() { * @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)); } /** @@ -72,7 +72,7 @@ public function get_url() { * @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 e3bd1a3fe0ec0..3cc951a282c4f 100644 --- a/user/view.php +++ b/user/view.php @@ -191,7 +191,8 @@ $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,