Commit 20e9dac8 authored by Andrew Nicols's avatar Andrew Nicols

MDL-53589 badges: Correct context

parent 71c7374d
......@@ -1141,12 +1141,7 @@ function profile_display_badges($userid, $courseid = 0) {
global $CFG, $PAGE, $USER, $SITE;
require_once($CFG->dirroot . '/badges/renderer.php');
// Determine context.
if (isloggedin()) {
$context = context_user::instance($USER->id);
} else {
$context = context_system::instance();
}
$context = context_user::instance($userid);
if ($USER->id == $userid || has_capability('moodle/badges:viewotherbadges', $context)) {
$records = badges_get_user_badges($userid, $courseid, null, null, null, true);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment