]> git.mjollnir.org Git - moodle.git/commitdiff
merged fix for parent forloginforprofile problem
authortoyomoyo <toyomoyo>
Mon, 12 Mar 2007 01:22:25 +0000 (01:22 +0000)
committertoyomoyo <toyomoyo>
Mon, 12 Mar 2007 01:22:25 +0000 (01:22 +0000)
user/view.php

index 9ee7053a12c7726210cad000f18dd88bb361607c..f3db2b96e20adb38cb79fb41c6133baede042506 100644 (file)
@@ -44,8 +44,8 @@
     }
     
     // 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))
+    if ($USER->id != $user->id 
+        && !has_capability('moodle/user:viewdetails', $coursecontext) 
         && !has_capability('moodle/user:viewdetails', $usercontext)) {
         error('You can not view the profile of this user');
     }
@@ -66,9 +66,8 @@
 /// If the user being shown is not ourselves, then make sure we are allowed to see them!
 
     if (!$currentuser) {
-
         if ($course->id == SITEID) {  // Reduce possibility of "browsing" userbase at site level
-            if ($CFG->forceloginforprofiles and !isteacherinanycourse() and !isteacherinanycourse($user->id)) {  // Teachers can browse and be browsed at site level. If not forceloginforprofiles, allow access (bug #4366)
+            if ($CFG->forceloginforprofiles and !isteacherinanycourse() and !isteacherinanycourse($user->id) and !has_capability('moodle/user:viewdetails', $usercontext)) {  // Teachers can browse and be browsed at site level. If not forceloginforprofiles, allow access (bug #4366)
                 print_header("$strpersonalprofile: ", "$strpersonalprofile: ",
                               "<a href=\"index.php?id=$course->id\">$strparticipants</a> -> $struser",
                               "", "", true, "&nbsp;", navmenu($course));