From f99d86ab539219debb060214d19dcbfad191a4b1 Mon Sep 17 00:00:00 2001 From: Renaat Debleu Date: Sun, 26 May 2024 07:11:27 +0000 Subject: [PATCH] coursecontext can be null --- lib.php | 11 ++++------- version.php | 4 ++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib.php b/lib.php index 2d30344..87b67d1 100755 --- a/lib.php +++ b/lib.php @@ -68,14 +68,11 @@ function report_payments_myprofile_navigation(\core_user\output\myprofile\tree $ if (isguestuser($user) || !isloggedin()) { return false; } - $contextuser = \context_user::instance($user->id); - $contextcourse = \context_course::instance($course->id); - if ( - has_capability('report/payments:userview', $contextuser) && - has_capability('report/payments:view', $contextcourse) - ) { + $context = \context_user::instance($user->id); + if (has_capability('report/payments:userview', $context)) { $url = new moodle_url('/report/payments/index.php', ['userid' => $user->id]); - $node = new \core_user\output\myprofile\node('reports', 'payments', get_string('payments'), null, $url); + $txt = get_string('payments'); + $node = new \core_user\output\myprofile\node('reports', 'payments', $txt, null, $url); $tree->add_node($node); } return true; diff --git a/version.php b/version.php index 698556d..c85b704 100755 --- a/version.php +++ b/version.php @@ -29,5 +29,5 @@ $plugin->component = 'report_payments'; $plugin->maturity = MATURITY_STABLE; $plugin->supported = [402, 404]; -$plugin->release = 'v4.4.2'; -$plugin->version = 2024052500; +$plugin->release = 'v4.4.3'; +$plugin->version = 2024052600;