From fb7b4b0a5fad7bdf2e5679795a883d40b61bfc96 Mon Sep 17 00:00:00 2001 From: PMKuipers Date: Wed, 6 Dec 2023 22:32:56 +0100 Subject: [PATCH] Hotfix for issue with navigation for users who do not have view rights for one of the level 1 categories --- classes/local/helpers/webservicehelper.php | 6 ++++++ version.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/classes/local/helpers/webservicehelper.php b/classes/local/helpers/webservicehelper.php index f3577f4..3fbf140 100644 --- a/classes/local/helpers/webservicehelper.php +++ b/classes/local/helpers/webservicehelper.php @@ -74,6 +74,12 @@ class webservicehelper { // Initialize parent if needed. if ($parent == null) { $parent = \core_course_category::user_top(); + + if ($parent == null) { + // If the parent is still null, we do not have a valid user top. + return false; + } + if (has_capability($capability, $parent->get_context())) { $list[] = $parent; } diff --git a/version.php b/version.php index 7b29828..9a7c5ab 100644 --- a/version.php +++ b/version.php @@ -25,7 +25,7 @@ $plugin->component = 'local_treestudyplan'; // Recommended since 2.0.2 (MDL-260 /* IMPORTANT: For studyplan-10 branch, only increment the iteration part of the version below since this is a bugfix branch */ -$plugin->version = 2023090701; // YYYYMMDDHH (year, month, day, iteration). +$plugin->version = 2023090702; // YYYYMMDDHH (year, month, day, iteration). $plugin->requires = 2021051700; // YYYYMMDDHH (This is the release version for Moodle 3.11). $plugin->release = "1.0.1";