MDL-53589 badges: fix capability check

This commit is contained in:
Tim Hunt 2016-03-22 17:22:18 +00:00 committed by Andrew Nicols
parent d4f96fa397
commit b9cc7e01a1

View File

@ -45,13 +45,7 @@ function core_badges_myprofile_navigation(\core_user\output\myprofile\tree $tree
// Add category. This node should appear after 'contact' so that administration block appears towards the end. Refer MDL-49928.
$category = new core_user\output\myprofile\category('badges', get_string('badges', 'badges'), 'contact');
$tree->add_category($category);
// Determine context.
if (isloggedin()) {
$context = context_user::instance($USER->id);
} else {
$context = context_system::instance();
}
$context = context_user::instance($user->id);
$courseid = empty($course) ? 0 : $course->id;
if ($USER->id == $user->id || has_capability('moodle/badges:viewotherbadges', $context)) {
@ -78,4 +72,4 @@ function core_badges_myprofile_navigation(\core_user\output\myprofile\tree $tree
}
}
}
}
}