diff --git a/user/profile.php b/user/profile.php
index d529654c8af..a219a710d6a 100644
--- a/user/profile.php
+++ b/user/profile.php
@@ -382,13 +382,18 @@ if (!isset($hiddenfields['mycourses'])) {
}
$class = 'class="dimmed"';
}
- $courselisting .= "wwwroot}/user/view.php?id={$user->id}&course={$mycourse->id}" .
- ($showallcourses ? "&showallcourses=1" : "") . "\" $class >" .
- $ccontext->get_context_name(false) . ", ";
+ $params = array('id' => $user->id, 'course' => $mycourse->id);
+ if ($showallcourses) {
+ $params['showallcourses'] = 1;
+ }
+ $url = new moodle_url('/user/view.php', $params);
+ $courselisting .= html_writer::link($url, $ccontext->get_context_name(false), array('class' => $class));
+ $courselisting .= ', ';
}
$shown++;
if (!$showallcourses && $shown == 20) {
- $courselisting .= "wwwroot}/user/profile.php?id={$user->id}&showallcourses=1\">...";
+ $url = new moodle_url('/user/profile.php', array('id' => $user->id, 'showallcourses' => 1));
+ $courselisting .= html_writer::link($url, '...');
break;
}
}
diff --git a/user/view.php b/user/view.php
index 3763d20fe46..7f76d49bae7 100644
--- a/user/view.php
+++ b/user/view.php
@@ -326,8 +326,13 @@ if (!isset($hiddenfields['mycourses'])) {
}
$class = 'class="dimmed"';
}
- $courselisting .= "wwwroot}/user/view.php?id={$user->id}&course={$mycourse->id}" .
- ($showallcourses ? "&showallcourses=1" : "") . "\" $class >" . $cfullname . ", ";
+ $params = array('id' => $user->id, 'course' => $mycourse->id);
+ if ($showallcourses) {
+ $params['showallcourses'] = 1;
+ }
+ $url = new moodle_url('/user/view.php', $params);
+ $courselisting .= html_writer::link($url, $ccontext->get_context_name(false), array('class' => $class));
+ $courselisting .= ', ';
} else {
$courselisting .= $cfullname . ", ";
$PAGE->navbar->add($cfullname);
@@ -335,8 +340,8 @@ if (!isset($hiddenfields['mycourses'])) {
}
$shown++;
if (!$showallcourses && $shown >= 20) {
- $courselisting .= "wwwroot}/user/view.php?id={$user->id}" .
- "&course=$courseid&showallcourses=1\">...";
+ $url = new moodle_url('/user/view.php', array('id' => $user->id, 'course' => $courseid, 'showallcourses' => 1));
+ $courselisting .= html_writer::link($url, '...');
break;
}
}