]> git.mjollnir.org Git - moodle.git/commitdiff
Passing $course to require_login() provides correct and
authorstronk7 <stronk7>
Thu, 27 Sep 2007 23:37:42 +0000 (23:37 +0000)
committerstronk7 <stronk7>
Thu, 27 Sep 2007 23:37:42 +0000 (23:37 +0000)
automatic navlinks to the course. MDL-11452

course/user.php

index 63d9432f7a966ae18c5ed1baef334280cd951b25..a28f487dbf34b1d74658ec4fb190bb98fbf4a8fd 100644 (file)
@@ -13,8 +13,6 @@
     $page    = optional_param('page', 0, PARAM_INT);
     $perpage = optional_param('perpage', 100, PARAM_INT);
 
-    require_login();
-
     if (! $course = get_record("course", "id", $id)) {
         error("Course id is incorrect.");
     }
@@ -23,6 +21,8 @@
         error("User ID is incorrect");
     }
 
+    require_login($course);
+
     $coursecontext = get_context_instance(CONTEXT_COURSE, $id);
     $personalcontext = get_context_instance(CONTEXT_USER, $user->id);
 
@@ -43,7 +43,6 @@
     $fullname          = fullname($user, true);
 
     $navlinks = array();
-    $navlinks[] = array('name' => $course->shortname, 'link' => "course/view.php?id=$course->id", 'type' => 'misc');
 
     if ($course->id != SITEID) {
         $navlinks[] = array('name' => $strparticipants, 'link' => "../user/index.php?id=$course->id", 'type' => 'misc');