From 6288c923f6e75b1b2cda21f83cd8d816841a224f Mon Sep 17 00:00:00 2001 From: NeillM Date: Tue, 24 Jun 2014 10:02:56 +0100 Subject: [PATCH] MDL-45961 Customise this page button on user profile page only works correctly for users own profile --- user/profile.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/user/profile.php b/user/profile.php index a5c317b5050..0d48ebd7a5d 100644 --- a/user/profile.php +++ b/user/profile.php @@ -162,7 +162,7 @@ if ($PAGE->user_allowed_editing()) { // If we are viewing a system page as ordinary user, and the user turns // editing on, copy the system pages as new user pages, and get the // new page record. - if (!$currentpage = my_copy_page($USER->id, MY_PAGE_PUBLIC, 'user-profile')) { + if (!$currentpage = my_copy_page($userid, MY_PAGE_PUBLIC, 'user-profile')) { print_error('mymoodlesetup'); } $PAGE->set_context($usercontext); @@ -181,11 +181,11 @@ if ($PAGE->user_allowed_editing()) { } // Add button for editing page. - $params = array('edit' => !$edit); + $params = array('edit' => !$edit, 'id' => $userid); $resetbutton = ''; $resetstring = get_string('resetpage', 'my'); - $reseturl = new moodle_url("$CFG->wwwroot/user/profile.php", array('edit' => 1, 'reset' => 1)); + $reseturl = new moodle_url("$CFG->wwwroot/user/profile.php", array('edit' => 1, 'reset' => 1, 'id' => $userid)); if (!$currentpage->userid) { // Viewing a system page -- let the user customise it. @@ -422,7 +422,7 @@ if (!isset($hiddenfields['lastaccess'])) { if (has_capability('moodle/user:viewlastip', $usercontext) && !isset($hiddenfields['lastip'])) { if ($user->lastip) { - $iplookupurl = new moodle_url('/iplookup/index.php', array('ip' => $user->lastip, 'user' => $USER->id)); + $iplookupurl = new moodle_url('/iplookup/index.php', array('ip' => $user->lastip, 'user' => $user->id)); $ipstring = html_writer::link($iplookupurl, $user->lastip); } else { $ipstring = get_string("none");