Fixing bug # 4567: warning in get_my_courses
This commit is contained in:
+8
-4
@@ -2259,10 +2259,14 @@ function get_my_courses($userid, $sort='visible DESC,sortorder ASC') {
|
||||
$course[$student->course] = $student->course;
|
||||
}
|
||||
}
|
||||
$courses = get_records_list('course', 'id', implode(',', $course));
|
||||
foreach ($courses as $k => $c) {
|
||||
if (empty($USER->admin) && (!$c->visible || !course_parent_visible($c))) {
|
||||
unset($course[$c->id]);
|
||||
|
||||
if (count($course) > 0) {
|
||||
if ($courses = get_records_list('course', 'id', implode(',', $course))) {
|
||||
foreach ($courses as $k => $c) {
|
||||
if (empty($USER->admin) && (!$c->visible || !course_parent_visible($c))) {
|
||||
unset($course[$c->id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($teachers = get_records('user_teachers', 'userid', $userid, '', 'id, course')) {
|
||||
|
||||
Reference in New Issue
Block a user