From b16de8498069ef4e585205334d54d246585cabb1 Mon Sep 17 00:00:00 2001 From: moodler Date: Sun, 1 Oct 2006 08:34:36 +0000 Subject: [PATCH] get_role_users() can now get all the people who have any role in that context, which is useful --- lib/accesslib.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/accesslib.php b/lib/accesslib.php index 29bec9549d..8a55d7766e 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -2795,12 +2795,17 @@ function get_role_users($roleid, $context, $parent=false, $fields='u.*', $sort=' $parentcontexts = ''; } + if ($roleid) { + $roleselect = "AND r.roleid = $roleid"; + } else { + $roleselect = ''; + } + $SQL = "SELECT $fields FROM {$CFG->prefix}role_assignments r, {$CFG->prefix}user u WHERE (r.contextid = $context->id $parentcontexts) - AND r.roleid = $roleid - AND u.id = r.userid + AND u.id = r.userid $roleselect ORDER BY $sort "; // join now so that we can just use fullname() later -- 2.39.5