diff --git a/public/course/format/classes/external/get_state.php b/public/course/format/classes/external/get_state.php index fd52babf4d9..af12fe439a2 100644 --- a/public/course/format/classes/external/get_state.php +++ b/public/course/format/classes/external/get_state.php @@ -105,8 +105,8 @@ class get_state extends external_api { } foreach ($modinfo->cms as $cm) { - if ($cm->is_visible_on_course_page() && $cm->is_of_type_that_can_display()) { - // Only return this course module data if it's visible by current user on the course page. + if (($cm->is_visible_on_course_page() || $cm->is_stealth()) && $cm->is_of_type_that_can_display()) { + // Only return this course module data if it's accessible to the current user on the course page. $section = $sections[$cm->sectionnum]; $cmstate = new $cmclass($courseformat, $section, $cm, istrackeduser: $istrackeduser); $result->cm[] = $cmstate->export_for_template($renderer);