Skip to content

Commit

Permalink
MDL-36162 core_message: removed the unnecessary and confusing course …
Browse files Browse the repository at this point in the history
…URL parameter as well as fixing the broken breadcrumb
  • Loading branch information
andyjdavis committed Nov 1, 2012
1 parent 67ba008 commit e451aa7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 31 deletions.
2 changes: 1 addition & 1 deletion lib/navigationlib.php
Expand Up @@ -3785,7 +3785,7 @@ protected function generate_user_settings($courseid, $userid, $gstitle='usercurr

// Messaging
if (($currentuser && has_capability('moodle/user:editownmessageprofile', $systemcontext)) || (!isguestuser($user) && has_capability('moodle/user:editmessageprofile', $usercontext) && !is_primary_admin($user->id))) {
$url = new moodle_url('/message/edit.php', array('id'=>$user->id, 'course'=>$course->id));
$url = new moodle_url('/message/edit.php', array('id'=>$user->id));
$usersetting->add(get_string('editmymessage', 'message'), $url, self::TYPE_SETTING);
}

Expand Down
34 changes: 4 additions & 30 deletions message/edit.php
Expand Up @@ -27,30 +27,14 @@
require_once($CFG->dirroot . '/message/lib.php');

$userid = optional_param('id', $USER->id, PARAM_INT); // user id
$course = optional_param('course', SITEID, PARAM_INT); // course id (defaults to Site)
$disableall = optional_param('disableall', 0, PARAM_BOOL); //disable all of this user's notifications

$url = new moodle_url('/message/edit.php');
$url->param('id', $userid);
$url->param('course', $course);

$PAGE->set_url($url);

if (!$course = $DB->get_record('course', array('id' => $course))) {
print_error('invalidcourseid');
}

if ($course->id != SITEID) {
require_login($course);

} else {
if (!isloggedin()) {
if (empty($SESSION->wantsurl)) {
$SESSION->wantsurl = $CFG->httpswwwroot.'/message/edit.php';
}
redirect(get_login_url());
}
}
require_login();

if (isguestuser()) {
print_error('guestnoeditmessage', 'message');
Expand All @@ -72,10 +56,6 @@
if ($user->id == $USER->id) {
//editing own message profile
require_capability('moodle/user:editownmessageprofile', $systemcontext);
if ($course->id != SITEID && $node = $PAGE->navigation->find($course->id, navigation_node::TYPE_COURSE)) {
$node->make_active();
$PAGE->navbar->includesettingsbase = true;
}
} else {
// teachers, parents, etc.
require_capability('moodle/user:editmessageprofile', $personalcontext);
Expand Down Expand Up @@ -145,7 +125,7 @@
print_error('cannotupdateusermsgpref');
}

redirect("$CFG->wwwroot/message/edit.php?id=$user->id&course=$course->id");
redirect("$CFG->wwwroot/message/edit.php?id=$user->id");
}

/// Load preferences
Expand Down Expand Up @@ -180,14 +160,8 @@

/// Display page header
$streditmymessage = get_string('editmymessage', 'message');
$strparticipants = get_string('participants');

$PAGE->set_title("$course->shortname: $streditmymessage");
if ($course->id != SITEID) {
$PAGE->set_heading("$course->fullname: $streditmymessage");
} else {
$PAGE->set_heading($course->fullname);
}
$PAGE->set_title($streditmymessage);
$PAGE->set_heading($streditmymessage);

// Grab the renderer
$renderer = $PAGE->get_renderer('core', 'message');
Expand Down

0 comments on commit e451aa7

Please sign in to comment.