]> git.mjollnir.org Git - moodle.git/commitdiff
HIde admins from partipant listings in courses
authormoodler <moodler>
Fri, 20 Oct 2006 08:27:35 +0000 (08:27 +0000)
committermoodler <moodler>
Fri, 20 Oct 2006 08:27:35 +0000 (08:27 +0000)
user/index.php

index e8cfef1cfdd8f26b04502cf8641fe4a48815645a..ca064cc62307a707d08f74abca02ef362c1802e6 100644 (file)
 
 
     if ($roles = get_roles_used_in_context($context)) {
-        foreach ($roles as $role) {
+        
+        // We should exclude "admin" users (those with "doanything" at site level) because 
+        // Otherwise they appear in every participant list
+
+        $sitecontext = get_context_instance(CONTEXT_SYSTEM);
+        $doanythingroles = get_roles_with_capability('moodle/site:doanything', CAP_ALLOW, $sitecontext);
+
+          foreach ($roles as $role) {
+            if (isset($doanythingroles[$role->id])) {   // Avoid this role (ie admin)
+                unset($roles[$role->id]);
+                continue;
+            }
             $rolenames[$role->id] = strip_tags(format_string($role->name));   // Used in menus etc later on
         }
     }