mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
Passing $course to require_login() provides correct and
automatic navlinks to the course. MDL-11452
This commit is contained in:
parent
9fa46707f3
commit
6bb919860b
@ -13,8 +13,6 @@
|
|||||||
$page = optional_param('page', 0, PARAM_INT);
|
$page = optional_param('page', 0, PARAM_INT);
|
||||||
$perpage = optional_param('perpage', 100, PARAM_INT);
|
$perpage = optional_param('perpage', 100, PARAM_INT);
|
||||||
|
|
||||||
require_login();
|
|
||||||
|
|
||||||
if (! $course = get_record("course", "id", $id)) {
|
if (! $course = get_record("course", "id", $id)) {
|
||||||
error("Course id is incorrect.");
|
error("Course id is incorrect.");
|
||||||
}
|
}
|
||||||
@ -23,6 +21,8 @@
|
|||||||
error("User ID is incorrect");
|
error("User ID is incorrect");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require_login($course);
|
||||||
|
|
||||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $id);
|
$coursecontext = get_context_instance(CONTEXT_COURSE, $id);
|
||||||
$personalcontext = get_context_instance(CONTEXT_USER, $user->id);
|
$personalcontext = get_context_instance(CONTEXT_USER, $user->id);
|
||||||
|
|
||||||
@ -43,7 +43,6 @@
|
|||||||
$fullname = fullname($user, true);
|
$fullname = fullname($user, true);
|
||||||
|
|
||||||
$navlinks = array();
|
$navlinks = array();
|
||||||
$navlinks[] = array('name' => $course->shortname, 'link' => "course/view.php?id=$course->id", 'type' => 'misc');
|
|
||||||
|
|
||||||
if ($course->id != SITEID) {
|
if ($course->id != SITEID) {
|
||||||
$navlinks[] = array('name' => $strparticipants, 'link' => "../user/index.php?id=$course->id", 'type' => 'misc');
|
$navlinks[] = array('name' => $strparticipants, 'link' => "../user/index.php?id=$course->id", 'type' => 'misc');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user