]> git.mjollnir.org Git - moodle.git/commitdiff
merged stops showing admins from participants list
authortoyomoyo <toyomoyo>
Mon, 4 Dec 2006 03:05:40 +0000 (03:05 +0000)
committertoyomoyo <toyomoyo>
Mon, 4 Dec 2006 03:05:40 +0000 (03:05 +0000)
user/index.php

index f0bc5ff9dabf9d202eb4a3dd5aa94c8dec5a21e7..9abdc74dd2ee601e47b0282194885433c7d222cb 100644 (file)
     {$CFG->prefix}role_assignments r on u.id=r.userid LEFT OUTER JOIN
     {$CFG->prefix}user_lastaccess ul on (r.userid=ul.userid and ul.courseid = $course->id)"; 
     
-    $hiddensql = has_capability('moodle/role:viewhiddenassigns', $context)? '':' AND r.hidden = 0 ';
+    $hiddensql = has_capability('moodle/role:viewhiddenassigns', $context)? '':' AND r.hidden = 0 ';   
+
+    // excluse users with these admin role assignments
+    if ($doanythingroles) {
+        $adminroles = 'AND r.id NOT IN (';
+        foreach ($doanythingroles as $aroleid=>$role) {
+            $adminroles .= "$aroleid,";
+        }
+        $adminroles = rtrim($adminroles,",");
+        $adminroles .= ')';
+    } else {
+        $adminroles = '';
+    }
     
     // join on 2 conditions
     // otherwise we run into the problem of having records in ul table, but not relevant course
     $where  = "WHERE (r.contextid = $context->id OR r.contextid in $listofcontexts)
         AND u.deleted = 0 $selectrole
         AND (ul.courseid = $course->id OR ul.courseid IS NULL)
-        AND u.username <> 'guest' 
+        AND u.username != 'guest'
+        $adminroles
         $hiddensql ";
         $where .= get_lastaccess_sql($accesssince);