Skip to content
Snippets Groups Projects
Commit 9c660f35 authored by Kathrin Osswald's avatar Kathrin Osswald
Browse files

Fixed bug for the profile editing button in admin view.

parent 3301ca34
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@ Changes
### Unreleased
* 2018-01-12 - Fixed bug for the profile editing button in admin view.
* 2018-01-11 - Fixed bug in the hierarchical displaying of lists within the course.
* 2017-12-05 - Added Workaround to travis.yml for fixing Behat tests with TravisCI.
......
......@@ -183,8 +183,21 @@ class core_renderer extends \theme_boost\output\core_renderer {
// MODIFICATION START: Instead of the settings icon, add a button to edit the profile.
if ($PAGE->pagelayout == 'mypublic') {
$html .= html_writer::start_div('breadcrumb-button breadcrumb-button pull-xs-right');
$url = new moodle_url('/user/editadvanced.php', array('id' => $USER->id, 'course' => $COURSE->id,
$url = '';
// Get the id of the user for whom the profile page is shown.
$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)) &&
has_capability('moodle/user:update', \context_system::instance())) {
$url = new moodle_url('/user/editadvanced.php', array('id' => $userid, 'course' => $COURSE->id,
'returnto' => 'profile'));
} else if ((has_capability('moodle/user:editprofile', \context_user::instance($userid)) &&
!is_siteadmin($USER)) || ($currentuser &&
has_capability('moodle/user:editownprofile', \context_system::instance()))) {
$url = new moodle_url('/user/edit.php', array('id' => $userid, 'course' => $COURSE->id,
'returnto' => 'profile'));
}
$html .= $this->single_button($url, get_string('editmyprofile', 'core'));
$html .= html_writer::end_div();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment