MDL-52560 badges: Avoid trying to add badges when disabled
authorMichael Aherne <michael.aherne@strath.ac.uk>
Fri, 18 Dec 2015 14:13:32 +0000 (14:13 +0000)
committerMichael Aherne <michael.aherne@strath.ac.uk>
Fri, 18 Dec 2015 14:13:32 +0000 (14:13 +0000)
lib/navigationlib.php

index b3b79cc..4d11b1e 100644 (file)
@@ -3888,8 +3888,10 @@ class settings_navigation extends navigation_node {
         }
 
         //Add badges navigation
-        require_once($CFG->libdir .'/badgeslib.php');
-        badges_add_course_navigation($coursenode, $course);
+        if (!empty($CFG->enablebadges)) {
+            require_once($CFG->libdir .'/badgeslib.php');
+            badges_add_course_navigation($coursenode, $course);
+        }
 
         // Backup this course
         if (has_capability('moodle/backup:backupcourse', $coursecontext)) {