From 028044707f36c89090cb2005ce45e00e775e6173 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Sat, 6 Feb 2016 14:55:46 +0000 Subject: [PATCH] MDL-49146 single-activity course format: key activity must be visible With a single-activity course, visibility to students is controlled by course visibility. There is no sense in having the key activity not visible to students, and, if you did, the symptoms were almost incomprehensible. It was very hard to work out what you had done wrong. --- course/format/singleactivity/lib.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/course/format/singleactivity/lib.php b/course/format/singleactivity/lib.php index 65cd546dc8f..813e2c62c1c 100644 --- a/course/format/singleactivity/lib.php +++ b/course/format/singleactivity/lib.php @@ -230,8 +230,16 @@ class format_singleactivity extends format_base { } // Make sure the current activity is in the 0-section. + $changed = false; if ($activity && $activity->sectionnum != 0) { moveto_module($activity, $modinfo->get_section_info(0)); + $changed = true; + } + if ($activity && !$activity->visible) { + set_coursemodule_visible($activity->id, 1); + $changed = true; + } + if ($changed) { // Cache was reset so get modinfo again. $modinfo = get_fast_modinfo($this->courseid); } -- 2.43.0