get_role_users() can now get all the people who have any role in that context,

which is useful
This commit is contained in:
moodler 2006-10-01 08:34:36 +00:00
parent a971a5985a
commit b16de84980

View file

@ -2795,12 +2795,17 @@ function get_role_users($roleid, $context, $parent=false, $fields='u.*', $sort='
$parentcontexts = ''; $parentcontexts = '';
} }
if ($roleid) {
$roleselect = "AND r.roleid = $roleid";
} else {
$roleselect = '';
}
$SQL = "SELECT $fields $SQL = "SELECT $fields
FROM {$CFG->prefix}role_assignments r, FROM {$CFG->prefix}role_assignments r,
{$CFG->prefix}user u {$CFG->prefix}user u
WHERE (r.contextid = $context->id $parentcontexts) WHERE (r.contextid = $context->id $parentcontexts)
AND r.roleid = $roleid AND u.id = r.userid $roleselect
AND u.id = r.userid
ORDER BY $sort ORDER BY $sort
"; // join now so that we can just use fullname() later "; // join now so that we can just use fullname() later