MDL-59412 course: do not display completion icon for unavailable mod
authorMarina Glancy <marina@moodle.com>
Thu, 29 Jun 2017 02:37:09 +0000 (10:37 +0800)
committerMarina Glancy <marina@moodle.com>
Wed, 5 Jul 2017 01:48:18 +0000 (09:48 +0800)
course/renderer.php

index 565f90c..609ae6a 100644 (file)
@@ -450,7 +450,7 @@ class core_course_renderer extends plugin_renderer_base {
     public function course_section_cm_completion($course, &$completioninfo, cm_info $mod, $displayoptions = array()) {
         global $CFG;
         $output = '';
-        if (!$mod->is_visible_on_course_page()) {
+        if (!empty($displayoptions['hidecompletion']) || !isloggedin() || isguestuser() || !$mod->uservisible) {
             return $output;
         }
         if ($completioninfo === null) {