From 43dcc048cb2906aeb4d0af507363fd7e68855a99 Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Fri, 20 Dec 2024 14:32:42 +1300 Subject: [PATCH] Fix #796 - fix sql query when custom fields included. --- absentee.php | 6 ++++-- locallib.php | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/absentee.php b/absentee.php index 205a8a4540..41f3cc4a78 100644 --- a/absentee.php +++ b/absentee.php @@ -89,8 +89,10 @@ if (!empty($CFG->showuseridentity) && has_capability('moodle/site:viewuseridentity', $context)) { $extrafields = explode(',', $CFG->showuseridentity); foreach ($extrafields as $field) { - $columns[] = $field; - $headers[] = get_string($field); + if (strpos($field, 'profile_field') !== 0) { + $columns[] = $field; + $headers[] = get_string($field); + } } } $columns = array_merge($columns, ['numtakensessions', 'percent', 'timesent']); diff --git a/locallib.php b/locallib.php index 3e65a452a1..ac9e04af71 100644 --- a/locallib.php +++ b/locallib.php @@ -1109,8 +1109,10 @@ function attendance_get_users_to_notify($courseids = [], $orderby = '', $allforn if (!empty($CFG->showuseridentity)) { $extrafields = explode(',', $CFG->showuseridentity); foreach ($extrafields as $field) { - $unames .= $field . ', '; - $unames2 .= 'u.' . $field . ', '; + if (strpos($field, 'profile_field') !== 0) { + $unames .= $field . ', '; + $unames2 .= 'u.' . $field . ', '; + } } }