From a954633875c5f732e6c1f107031c8a8651b65b71 Mon Sep 17 00:00:00 2001 From: moodler Date: Fri, 20 Oct 2006 08:27:35 +0000 Subject: [PATCH] HIde admins from partipant listings in courses --- user/index.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/user/index.php b/user/index.php index e8cfef1cfd..ca064cc623 100644 --- a/user/index.php +++ b/user/index.php @@ -252,7 +252,18 @@ 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 } } -- 2.39.5