Permalink
Browse files

Fixing warning (http://moodle.org/mod/forum/discuss.php?d=36226#167658

…- not applicable to HEAD
  • Loading branch information...
1 parent d3322e6 commit 0441f512f50e395a2c80259f7f9baf129693867b mjollnir_ committed Dec 14, 2005
Showing with 6 additions and 4 deletions.
  1. +6 −4 lib/datalib.php
View
@@ -2227,10 +2227,12 @@ 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($courses) > 0) {
+ $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')) {

0 comments on commit 0441f51

Please sign in to comment.