From 98125d376a6ef1b3cf51ae217d37543e7eec00c9 Mon Sep 17 00:00:00 2001 From: David Bogner Date: Fri, 23 Nov 2018 17:46:38 +0100 Subject: [PATCH] MDL-57636 frontpage: Fix display enrolled courses --- index.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index 502093ca854..0a23cfb3777 100644 --- a/index.php +++ b/index.php @@ -188,7 +188,8 @@ if (isloggedin() and !isguestuser() and isset($CFG->frontpageloggedin)) { $frontpagelayout = $CFG->frontpage; } -foreach (explode(',', $frontpagelayout) as $v) { +$frontpageoptions = explode(',', $frontpagelayout); +foreach ($frontpageoptions as $v) { switch ($v) { // Display the main part of the front page. case FRONTPAGENEWS: @@ -256,8 +257,13 @@ foreach (explode(',', $frontpagelayout) as $v) { echo html_writer::tag('span', '', array('class' => 'skip-block-to', 'id' => 'skipmycourses')); break; + } else { + // Temp fix/fallback in order to display available courses when enrolled courses should be shown, + // but user is not enrolled in any course. + if (array_search(FRONTPAGEALLCOURSELIST, $frontpageoptions)) { + break; + } } - // No "break" here. If there are no enrolled courses - continue to 'Available courses'. case FRONTPAGEALLCOURSELIST: $availablecourseshtml = $courserenderer->frontpage_available_courses();