From 3e2570611f16aeb0e377175a2e708eb333d5c408 Mon Sep 17 00:00:00 2001 From: Huong Nguyen Date: Thu, 29 Apr 2021 14:42:49 +0700 Subject: [PATCH] MDL-71486 course: Notice when in site home/course page --- lib/modinfolib.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/modinfolib.php b/lib/modinfolib.php index 8b8397b8ad5..75cf363f6f5 100644 --- a/lib/modinfolib.php +++ b/lib/modinfolib.php @@ -1928,7 +1928,7 @@ class cm_info implements IteratorAggregate { // Check parent section. if ($this->available) { $parentsection = $this->modinfo->get_section_info($this->sectionnum); - if (!$parentsection->available) { + if (!$parentsection->get_available()) { // Do not store info from section here, as that is already // presented from the section (if appropriate) - just change // the flag @@ -2787,11 +2787,12 @@ class section_info implements IteratorAggregate { /** * Finds whether this section is available at the moment for the current user. * - * The value can be accessed publicly as $sectioninfo->available + * The value can be accessed publicly as $sectioninfo->available, but can be called directly if there + * is a case when it might be called recursively (you can't call property values recursively). * * @return bool */ - private function get_available() { + public function get_available() { global $CFG; $userid = $this->modinfo->get_user_id(); if ($this->_available !== null || $userid == -1) {