From 51301fa60f15b5d2b80ac5feba588fb0cddd12c0 Mon Sep 17 00:00:00 2001
From: Melanie Treitinger <66598405+melanietreitinger@users.noreply.github.com>
Date: Thu, 6 Jan 2022 11:42:32 +0100
Subject: [PATCH] Profile button with "editadvanced" link for users with
 capability 'moodle/user:update' (#118)

Be consistent with function core_myprofile_navigation() in lib/myprofilelib.php:
Users with the capability 'moodle/user:update' shall be able to go to "user/editadvanced.php" when editing a non-admin user.
---
 classes/output/core_renderer.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/classes/output/core_renderer.php b/classes/output/core_renderer.php
index 6596d86..347da7c 100644
--- a/classes/output/core_renderer.php
+++ b/classes/output/core_renderer.php
@@ -168,7 +168,7 @@ class core_renderer extends \core_renderer {
             $userid = optional_param('id', $USER->id, PARAM_INT);
             // Check if the shown and the operating user are identical.
             $currentuser = $USER->id == $userid;
-            if (($currentuser || is_siteadmin($USER)) &&
+            if (($currentuser || is_siteadmin($USER) || !is_siteadmin($userid)) &&
                 has_capability('moodle/user:update', \context_system::instance())) {
                 $url = new moodle_url('/user/editadvanced.php', array('id'       => $userid, 'course' => $COURSE->id,
                                                                       'returnto' => 'profile'));
-- 
GitLab