diff --git a/blocks/course_list/block_course_list.php b/blocks/course_list/block_course_list.php index aaf657030c0..d4599826a2a 100644 --- a/blocks/course_list/block_course_list.php +++ b/blocks/course_list/block_course_list.php @@ -35,7 +35,14 @@ class block_course_list extends block_list { if (empty($CFG->disablemycourses) and isloggedin() and !isguestuser() and !(has_capability('moodle/course:update', context_system::instance()) and $adminseesall)) { // Just print My Courses - if ($courses = enrol_get_my_courses(NULL, 'visible DESC, fullname ASC')) { + // As this is producing navigation sort order should default to $CFG->navsortmycoursessort instead + // of using the default. + if (!empty($CFG->navsortmycoursessort)) { + $sortorder = 'visible DESC, ' . $CFG->navsortmycoursessort . ' ASC'; + } else { + $sortorder = 'visible DESC, sortorder ASC'; + } + if ($courses = enrol_get_my_courses(NULL, $sortorder)) { foreach ($courses as $course) { $coursecontext = context_course::instance($course->id); $linkcss = $course->visible ? "" : " class=\"dimmed\" ";