Skip to content

Commit

Permalink
coursecontext can be null
Browse files Browse the repository at this point in the history
  • Loading branch information
rdebleu committed May 26, 2024
1 parent 18873b0 commit f99d86a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
11 changes: 4 additions & 7 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit f99d86a

Please sign in to comment.