diff --git a/course/view.php b/course/view.php index a8178658406..7a4d7aa37ab 100644 --- a/course/view.php +++ b/course/view.php @@ -177,7 +177,7 @@ // what to do, even though the link also appears in the course admin block. It also // means you can back out of a situation where you removed the admin block. :) if ($PAGE->user_allowed_editing()) { - $buttons = $OUTPUT->edit_button(new moodle_url('/course/view.php', array('id' => $course->id))); + $buttons = $OUTPUT->edit_button($PAGE->url); $PAGE->set_button($buttons); } diff --git a/lib/navigationlib.php b/lib/navigationlib.php index 0336362b9ef..d2e7ed5928c 100644 --- a/lib/navigationlib.php +++ b/lib/navigationlib.php @@ -3282,7 +3282,15 @@ class settings_navigation extends navigation_node { if (has_capability('moodle/course:update', $coursecontext)) { // Add the turn on/off settings - $url = new moodle_url('/course/view.php', array('id'=>$course->id, 'sesskey'=>sesskey())); + + if ($this->page->url->compare(new moodle_url('/course/view.php'), URL_MATCH_BASE)) { + // We are on the course page, retain the current page params e.g. section. + $url = clone($this->page->url); + $url->param('sesskey', sesskey()); + } else { + // Edit on the main course page. + $url = new moodle_url('/course/view.php', array('id'=>$course->id, 'sesskey'=>sesskey())); + } if ($this->page->user_is_editing()) { $url->param('edit', 'off'); $editstring = get_string('turneditingoff');