Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'MDL-34250_23' of github.com:stronk7/moodle into MOODLE_…

…23_STABLE
  • Loading branch information...
commit 5e143a271c468533313814d0debecd66207bbb37 2 parents 56c5e1d + ffbe597
Eloy Lafuente (stronk7) stronk7 authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/navigationlib.php
8 lib/navigationlib.php
View
@@ -1131,7 +1131,13 @@ public function initialise() {
$addedcategories[$category->id] = $categoryparent->add($category->name, $url, self::TYPE_CATEGORY, $category->name, $category->id);
if (!$category->visible) {
- if (!has_capability('moodle/category:viewhiddencategories', get_context_instance(CONTEXT_COURSECAT, $category->parent))) {
+ // Let's decide the context where viewhidden cap checks will happen.
+ if ($category->parent == '0') {
+ $contexttocheck = context_system::instance();
+ } else {
+ $contexttocheck = context_coursecat::instance($category->parent);
+ }
+ if (!has_capability('moodle/category:viewhiddencategories', $contexttocheck)) {
$addedcategories[$category->id]->display = false;
} else {
$addedcategories[$category->id]->hidden = true;
Please sign in to comment.
Something went wrong with that request. Please try again.