diff --git a/user/profile.php b/user/profile.php index 291fc131f6f..8b1bb5c8801 100644 --- a/user/profile.php +++ b/user/profile.php @@ -375,19 +375,19 @@ if (!isset($hiddenfields['mycourses'])) { if ($mycourse->category) { context_helper::preload_from_record($mycourse); $ccontext = context_course::instance($mycourse->id); - $class = ''; + $linkattributes = null; if ($mycourse->visible == 0) { if (!has_capability('moodle/course:viewhiddencourses', $ccontext)) { continue; } - $class = 'class="dimmed"'; + $linkattributes['class'] = 'dimmed'; } $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 .= html_writer::link($url, $ccontext->get_context_name(false), $linkattributes); $courselisting .= ', '; } $shown++; diff --git a/user/view.php b/user/view.php index 06a8baccb72..443099151b5 100644 --- a/user/view.php +++ b/user/view.php @@ -319,19 +319,19 @@ if (!isset($hiddenfields['mycourses'])) { $ccontext = context_course::instance($mycourse->id); $cfullname = $ccontext->get_context_name(false); if ($mycourse->id != $course->id) { - $class = ''; + $linkattributes = null; if ($mycourse->visible == 0) { if (!has_capability('moodle/course:viewhiddencourses', $ccontext)) { continue; } - $class = 'class="dimmed"'; + $linkattributes['class'] = 'dimmed'; } $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 .= html_writer::link($url, $ccontext->get_context_name(false), $linkattributes); $courselisting .= ', '; } else { $courselisting .= $cfullname . ", ";