MDL-56292 message: fix param in notificationpreferences.php

This commit is contained in:
Ryan Wyllie 2016-09-29 03:47:04 +00:00 committed by Mark Nelson
parent df9986c87f
commit bab2ec4664
3 changed files with 5 additions and 12 deletions

View File

@ -4536,7 +4536,7 @@ class settings_navigation extends navigation_node {
if (($currentuser && has_capability('moodle/user:editownmessageprofile', $systemcontext)) || (!isguestuser($user) &&
has_capability('moodle/user:editmessageprofile', $usercontext) && !is_primary_admin($user->id))) {
$messagingurl = new moodle_url('/message/edit.php', array('id' => $user->id));
$notificationsurl = new moodle_url('/message/notificationpreferences.php', array('id' => $user->id));
$notificationsurl = new moodle_url('/message/notificationpreferences.php', array('userid' => $user->id));
$useraccount->add(get_string('messagepreferences', 'message'), $messagingurl, self::TYPE_SETTING);
$useraccount->add(get_string('notificationpreferences', 'message'), $notificationsurl, self::TYPE_SETTING);
}

View File

@ -3206,7 +3206,7 @@ EOD;
$context = [
'userid' => $USER->id,
'urls' => [
'preferences' => (new moodle_url('/message/notificationpreferences.php', ['id' => $USER->id]))->out(),
'preferences' => (new moodle_url('/message/notificationpreferences.php', ['userid' => $USER->id]))->out(),
],
];
return $this->render_from_template('message/notification_popover', $context);

View File

@ -26,14 +26,9 @@ require_once(__DIR__ . '/../config.php');
require_once($CFG->dirroot . '/message/lib.php');
require_once($CFG->dirroot . '/user/lib.php');
$userid = optional_param('id', 0, PARAM_INT); // User id.
if (!$userid) {
$userid = $USER->id;
}
$userid = optional_param('userid', $USER->id, PARAM_INT); // User id.
$url = new moodle_url('/message/notificationpreferences.php');
$url->param('id', $userid);
$url->param('userid', $userid);
$PAGE->set_url($url);
@ -43,9 +38,7 @@ if (isguestuser()) {
print_error('guestnoeditmessage', 'message');
}
if (!$user = $DB->get_record('user', array('id' => $userid))) {
print_error('invaliduserid');
}
$user = $DB->get_record('user', array('id' => $userid), '*', MUST_EXIST);
$systemcontext = context_system::instance();
$personalcontext = context_user::instance($user->id);