MDL-76074 completion: fixed filter in reports with custom user fields
When the site uses custom user text fields that would show up in a user list, the filter for firstname or lastname didnt work anymore. If a filter was used, no result would show up. Users where shown only when the course reports where used without filters.
This commit is contained in:
@@ -1424,14 +1424,15 @@ class completion_info {
|
||||
$fieldssql = $userfieldsapi->get_sql('u', true);
|
||||
$sql = 'SELECT u.id, u.idnumber ' . $fieldssql->selects;
|
||||
$sql .= ' FROM (' . $enrolledsql . ') eu JOIN {user} u ON u.id = eu.id';
|
||||
$sql .= $fieldssql->joins;
|
||||
$params = array_merge($params, $fieldssql->params);
|
||||
|
||||
if ($where) {
|
||||
$sql .= " AND $where";
|
||||
$params = array_merge($params, $whereparams);
|
||||
}
|
||||
|
||||
$sql .= $fieldssql->joins;
|
||||
$params = array_merge($params, $fieldssql->params);
|
||||
|
||||
if ($sort) {
|
||||
$sql .= " ORDER BY $sort";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user