Permalink
Browse files

MDL-36103 tablelib: links to user profiles are wrong in courses.

  • Loading branch information...
1 parent 10c3c37 commit a9c7672efad9852754e84b09e49f1558241d6afb @timhunt timhunt committed Oct 19, 2012
Showing with 10 additions and 7 deletions.
  1. +10 −7 lib/tablelib.php
View
17 lib/tablelib.php
@@ -734,16 +734,19 @@ function format_row($row) {
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);
}
/**

0 comments on commit a9c7672

Please sign in to comment.