From 3d6fb349ebd0f3786bfdd0310a7ab71a408c2edd Mon Sep 17 00:00:00 2001 From: Sam Hemelryk Date: Wed, 6 Mar 2013 14:35:19 +1300 Subject: [PATCH] MDL-32975 navigation: fixed error when viewing my with no enrolments --- lib/navigationlib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/navigationlib.php b/lib/navigationlib.php index 4528e5a958e..1c9f54eae1e 100644 --- a/lib/navigationlib.php +++ b/lib/navigationlib.php @@ -2657,7 +2657,7 @@ class global_navigation extends navigation_node { // Append the chosen sortorder. $sortorder = $sortorder . ',' . $CFG->navsortmycoursessort . ' ASC'; $courses = enrol_get_my_courses(null, $sortorder); - if ($this->show_my_categories(true)) { + if (count($courses) && $this->show_my_categories()) { // OK Actually we are loading categories. We only want to load categories that have a parent of 0. // In order to make sure we load everything required we must first find the categories that are not // base categories and work out the bottom category in thier path.