mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 04:30:15 +01:00
MDL-37177 navigation: Prevent exception when viewing a profile
When viewing a profile as a non-authenticated user, an exception was raised because we were trying to fetch the context of this user.
This commit is contained in:
parent
b3778a0dec
commit
d422fb22f7
@ -2157,8 +2157,7 @@ class global_navigation extends navigation_node {
|
||||
$usernode->add(get_string('messages', 'message'), $url, self::TYPE_SETTING, null, 'messages');
|
||||
}
|
||||
|
||||
$context = context_user::instance($USER->id);
|
||||
if ($iscurrentuser && has_capability('moodle/user:manageownfiles', $context)) {
|
||||
if ($iscurrentuser && has_capability('moodle/user:manageownfiles', context_user::instance($USER->id))) {
|
||||
$url = new moodle_url('/user/files.php');
|
||||
$usernode->add(get_string('myfiles'), $url, self::TYPE_SETTING);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user