Skip to content

Commit

Permalink
MDL-13314 count_role_users was showing different count to those retur…
Browse files Browse the repository at this point in the history
…ned from

get_role_users(), based on patch from Patrick Pollett
merged from MOODLE_19_STABLE
  • Loading branch information
poltawski committed Feb 5, 2008
1 parent e08dc18 commit f405c6e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/accesslib.php
Expand Up @@ -4927,10 +4927,13 @@ function count_role_users($roleid, $context, $parent=false) {
$parentcontexts = '';
}

$SQL = "SELECT count(*)
FROM {$CFG->prefix}role_assignments r
WHERE (r.contextid = $context->id $parentcontexts)
AND r.roleid = $roleid";
$SQL = "SELECT count(u.id)
FROM {$CFG->prefix}role_assignments r
JOIN {$CFG->prefix}user u
ON u.id = r.userid
WHERE (r.contextid = $context->id $parentcontexts)
AND r.roleid = $roleid
AND u.deleted = 0";

return count_records_sql($SQL);
}
Expand Down

0 comments on commit f405c6e

Please sign in to comment.