From 9efd335f4a06d6a0085b06cb59a22ecdd6b6d52a Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Tue, 11 Apr 2023 22:27:06 +0100 Subject: [PATCH] MDL-77882 gradereport_grader: don't search on custom identity field. Currently throws SQL exceptions if site identity configuration has such a field included. --- grade/report/lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grade/report/lib.php b/grade/report/lib.php index 89b8ac9c23a..511f9fcf446 100644 --- a/grade/report/lib.php +++ b/grade/report/lib.php @@ -487,7 +487,7 @@ abstract class grade_report { if ($this->usersearch !== '' && $this->userid === -1) { // Get the fields for all contexts because there is a special case later where it allows // matches of fields you can't access if they are on your own account. - $userfields = fields::for_identity(null)->with_userpic(); + $userfields = fields::for_identity(null, false)->with_userpic(); ['mappings' => $mappings] = (array)$userfields->get_sql('u', true); [ 'where' => $keywordswhere, @@ -555,7 +555,7 @@ abstract class grade_report { $conditions[] = $idnumber; // Search all user identify fields. - $extrasearchfields = fields::get_identity_fields(null); + $extrasearchfields = fields::get_identity_fields(null, false); foreach ($extrasearchfields as $fieldindex => $extrasearchfield) { if (in_array($extrasearchfield, ['email', 'idnumber', 'country'])) { // Already covered above.