From 1dcb9ff1f5490a2a56ae2fc482de745cbcd28dcd Mon Sep 17 00:00:00 2001 From: Yuliya Bozhko Date: Mon, 10 Jun 2013 16:21:55 +1200 Subject: [PATCH] MDL-39825 badges: Remove badges from course navigation when course badges are disabled --- lib/navigationlib.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/navigationlib.php b/lib/navigationlib.php index 3be7a1fff08..b979c2179f6 100644 --- a/lib/navigationlib.php +++ b/lib/navigationlib.php @@ -2448,9 +2448,9 @@ class global_navigation extends navigation_node { } // Badges. - if (!empty($CFG->enablebadges) && has_capability('moodle/badges:viewbadges', $this->page->context)) { - $url = new moodle_url($CFG->wwwroot . '/badges/view.php', - array('type' => 2, 'id' => $course->id)); + if (!empty($CFG->enablebadges) && !empty($CFG->badges_allowcoursebadges) && + has_capability('moodle/badges:viewbadges', $this->page->context)) { + $url = new moodle_url('/badges/view.php', array('type' => 2, 'id' => $course->id)); $coursenode->add(get_string('coursebadges', 'badges'), null, navigation_node::TYPE_CONTAINER, null, 'coursebadges'); @@ -2499,7 +2499,7 @@ class global_navigation extends navigation_node { } //Badges - if (!empty($CFG->enablebadges) && !empty($CFG->badges_allowcoursebadges) && has_capability('moodle/badges:viewbadges', $this->page->context)) { + if (!empty($CFG->enablebadges) && has_capability('moodle/badges:viewbadges', $this->page->context)) { $url = new moodle_url($CFG->wwwroot . '/badges/view.php', array('type' => 1)); $coursenode->add(get_string('sitebadges', 'badges'), $url, navigation_node::TYPE_CUSTOM); }