From 28788427423d18d41294d956ca72161ed94679a2 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Fri, 19 Oct 2012 16:49:34 +0800 Subject: [PATCH 1/1] MDL-36103 tablelib: links to user profiles are wrong in courses. --- lib/tablelib.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/tablelib.php b/lib/tablelib.php index 6de22af776a..2a08616859e 100644 --- a/lib/tablelib.php +++ b/lib/tablelib.php @@ -727,16 +727,19 @@ class flexible_table { function col_fullname($row) { global $COURSE, $CFG; - if (!$this->download) { - $profileurl = new moodle_url('/user/profile.php', array('id' => $row->{$this->useridfield})); - if ($COURSE->id != SITEID) { - $profileurl->param('course', $COURSE->id); - } - return html_writer::link($profileurl, fullname($row)); + $name = fullname($row); + if ($this->download) { + return $name; + } + $userid = $row->{$this->useridfield}; + if ($COURSE->id == SITEID) { + $profileurl = new moodle_url('/user/profile.php', array('id' => $userid)); } else { - return fullname($row); + $profileurl = new moodle_url('/user/view.php', + array('id' => $userid, 'course' => $COURSE->id)); } + return html_writer::link($profileurl, $name); } /** -- 2.43.0