Error reading from DB Unknown column 'uf1d_1.data' in 'field list'
When reviewing the certificate for a given course is showing an error:

With the debug mode we got the following:
Unknown column 'uf1d_1.data' in 'field list'
SELECT u.id, u.picture, u.firstname, u.lastname, u.firstnamephonetic, u.lastnamephonetic, u.middlename, u.alternatename, u.imagealt, u.email, u.department, u.country, uf1d_1.data AS profile_field_Organization, uf1d_2.data AS profile_field_Department, uf1d_3.data AS profile_field_Additional_Phone, uf1d_4.data AS profile_field_Additional_email, ci.id as issueid, ci.code, ci.timecreated
FROM mdl_user u
INNER JOIN mdl_customcert_issues ci
ON u.id = ci.userid
WHERE u.deleted = 0
AND ci.customcertid = ?
AND NOT u.id IN (?,?,?,?,?,?,?,?,?,?,?)
ORDER BY CONCAT(firstname, ' ', lastname) LIMIT 0, 50
[array (
0 => '1',
1 => 11,
2 => 9,
3 => 3,
4 => 13,
5 => 10,
6 => 15,
7 => 16,
8 => 4,
9 => 2,
10 => 4,
11 => 6,
)]
Error code: dmlreadexception
Seems it is not getting the custom fields added to the profile
Can you please provide replication steps?
What version of Moodle and the plugin are you using?
Just noting this may be due to https://github.com/mdjnelson/moodle-mod_customcert/issues/423.
We're using moodle 3.11, to be precise: version 3.11+ (Build: 20210617) (2021051700.07)
Whenever custom profile fields are added to the show user identity, the issue appears:

When the fields are removed, the issue is no longer present, when enabling the debug mode developer we can see the query posted on top and you can see it misses the uf1d_1 table in the FROM clause and the proper join
Thanks @VictorBenet, will take a look when I get the chance. If you can provide a patch that would be great.
I tried to replicate this and it all works fine in 3.11, 3.10 and 3.9 which are the currently supported versions. Please update to resolve this.
Reopened due to https://moodle.org/mod/forum/discuss.php?d=428088.
Closing again. See https://github.com/mdjnelson/moodle-mod_customcert/issues/465 which has a solution.