With get_my_courses() properly filtering out not vievable
courses for the user requesting the list, perfomr proper dimming of not visible courses. Backported from HEAD. MDL-12855
This commit is contained in:
+9
-3
@@ -306,14 +306,20 @@
|
||||
/// Print the Custom User Fields
|
||||
profile_display_fields($user->id);
|
||||
|
||||
|
||||
if ($mycourses = get_my_courses($user->id, null, null, false, 21)) {
|
||||
$shown=0;
|
||||
$courselisting = '';
|
||||
foreach ($mycourses as $mycourse) {
|
||||
if ($mycourse->visible and $mycourse->category) {
|
||||
if ($mycourse->category) {
|
||||
if ($mycourse->id != $course->id){
|
||||
$courselisting .= "<a href=\"$CFG->wwwroot/user/view.php?id=$user->id&course=$mycourse->id\">"
|
||||
$class = '';
|
||||
if ($mycourse->visible == 0) {
|
||||
// get_my_courses will filter courses $USER cannot see
|
||||
// if we get one with visible 0 it just means it's hidden
|
||||
// ... but not from $USER
|
||||
$class = 'class="dimmed"';
|
||||
}
|
||||
$courselisting .= "<a href=\"{$CFG->wwwroot}/user/view.php?id={$user->id}&course={$mycourse->id}\" $class >"
|
||||
. format_string($mycourse->fullname) . "</a>, ";
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user