mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-73684 core_user: check edit capability only when user exists
This commit is contained in:
parent
e63604fb6d
commit
3cc217193a
@ -506,9 +506,11 @@ class profile_field_base {
|
||||
}
|
||||
|
||||
// Checking for mentors have capability to edit user's profile.
|
||||
$usercontext = context_user::instance($this->userid);
|
||||
if ($this->userid != $USER->id && has_capability('moodle/user:editprofile', $usercontext, $USER->id)) {
|
||||
return true;
|
||||
if ($this->userid > 0) {
|
||||
$usercontext = context_user::instance($this->userid);
|
||||
if ($this->userid != $USER->id && has_capability('moodle/user:editprofile', $usercontext, $USER->id)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user