Skip to content

Commit

Permalink
MDL-53589 badges: Correct context
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed May 6, 2016
1 parent 71c7374 commit 20e9dac
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions lib/badgeslib.php
Expand Up @@ -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);
Expand Down

0 comments on commit 20e9dac

Please sign in to comment.