merged stops showing admins from participants list

This commit is contained in:
toyomoyo 2006-12-04 03:05:40 +00:00
parent 30c82426e3
commit c05275675b

View File

@ -337,7 +337,20 @@
{$CFG->prefix}role_assignments r on u.id=r.userid LEFT OUTER JOIN
{$CFG->prefix}user_lastaccess ul on (r.userid=ul.userid and ul.courseid = $course->id)";
$hiddensql = has_capability('moodle/role:viewhiddenassigns', $context)? '':' AND r.hidden = 0 ';
$hiddensql = has_capability('moodle/role:viewhiddenassigns', $context)? '':' AND r.hidden = 0 ';
// excluse users with these admin role assignments
if ($doanythingroles) {
$adminroles = 'AND r.id NOT IN (';
foreach ($doanythingroles as $aroleid=>$role) {
$adminroles .= "$aroleid,";
}
$adminroles = rtrim($adminroles,",");
$adminroles .= ')';
} else {
$adminroles = '';
}
// join on 2 conditions
// otherwise we run into the problem of having records in ul table, but not relevant course
@ -345,7 +358,8 @@
$where = "WHERE (r.contextid = $context->id OR r.contextid in $listofcontexts)
AND u.deleted = 0 $selectrole
AND (ul.courseid = $course->id OR ul.courseid IS NULL)
AND u.username <> 'guest'
AND u.username != 'guest'
$adminroles
$hiddensql ";
$where .= get_lastaccess_sql($accesssince);