]> git.mjollnir.org Git - moodle.git/commitdiff
merged fix for MDL-11064, users can't see teacher's profile
authortoyomoyo <toyomoyo>
Thu, 6 Sep 2007 07:09:36 +0000 (07:09 +0000)
committertoyomoyo <toyomoyo>
Thu, 6 Sep 2007 07:09:36 +0000 (07:09 +0000)
user/view.php

index 3eeffafde50f5242d0d48fc99da9a0d90aed18dc..b80fbb3ed4e2a138e87efd3590b5b0345551f7d1 100644 (file)
         }
     }
 
-    // make sure user can view this student's profile
-    if ($USER->id != $user->id
-        && !has_capability('moodle/user:viewdetails', $coursecontext)
-        && !has_capability('moodle/user:viewdetails', $usercontext)) {
-        print_error('cannotviewprofile');
-    }
-
     if (!empty($CFG->forceloginforprofiles)) {
         require_login();
         if (isguest()) {
                 exit;
             }
         } else {   // Normal course
+            // check capabilities
+            if (!has_capability('moodle/user:viewdetails', $coursecontext) && 
+                !has_capability('moodle/user:viewdetails', $usercontext)) {
+                print_error('cannotviewprofile');
+            }
+
             if (!has_capability('moodle/course:view', $coursecontext, $user->id, false)) {
                 if (has_capability('moodle/course:view', $coursecontext)) {
                     $navlinks[] = array('name' => $fullname, 'link' => null, 'type' => 'misc');