From 4726ad4fa4e20187dfcf438e56d685754f7a3e75 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Fri, 19 Oct 2012 16:49:34 +0800 Subject: [PATCH] MDL-36103 tablelib: links to user profiles are wrong in courses. --- lib/tablelib.php | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/tablelib.php b/lib/tablelib.php index 41df2e9e855..4281232a854 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)); - - } else { - return 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 { + $profileurl = new moodle_url('/user/view.php', + array('id' => $userid, 'course' => $COURSE->id)); + } + return html_writer::link($profileurl, $name); } /**