global $CFG;
if (!empty($exceptions)) {
- $except = ' AND u.id NOT IN ('. $exceptions .') ';
- } else {
- $except = '';
+ $exceptions = ' AND u.id NOT IN ('. $exceptions .') ';
+ }
+
+ if (!empty($sort)) {
+ $sort = ' ORDER by '.$sort;
}
return get_records_sql("SELECT u.id, u.username, u.firstname, u.lastname, u.maildisplay, u.mailformat, u.maildigest,
FROM {$CFG->prefix}user u,
{$CFG->prefix}user_teachers t
WHERE t.course = '$courseid' AND t.userid = u.id
- AND u.deleted = '0' AND u.confirmed = '1' $except
- ORDER BY $sort");
+ AND u.deleted = '0' AND u.confirmed = '1' $exceptions $sort");
}
/**
// vim:autoindent:expandtab:shiftwidth=4:tabstop=4:tw=140:
-?>
\ No newline at end of file
+?>