From c64dc2e545d164d90e2b4acd7294ef34e90e162c Mon Sep 17 00:00:00 2001 From: Peter Dias Date: Tue, 8 Mar 2022 13:59:00 +0800 Subject: [PATCH] MDL-73344 reports: Include the user/report node based on context Properly indicate the report node based on context. --- lib/pagelib.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/pagelib.php b/lib/pagelib.php index 6e5f3aa3798..6b311c02270 100644 --- a/lib/pagelib.php +++ b/lib/pagelib.php @@ -2031,7 +2031,9 @@ class moodle_page { $reportnode = null; $navigationnodeerror = 'Could not find the navigation node requested. Please check that the node you are looking for exists.'; - if ($userid != $USER->id) { + if ($userid != $USER->id || $this->context->contextlevel == CONTEXT_COURSE) { + // Within a course context we need to properly indicate how we have come to the page, + // regardless of whether it's currently logged in user or not. // Check that we have a valid node. if (empty($newusernode)) { // Throw an error if we ever reach here.