Closed vuvanhieu143 closed 2 years ago
Thanks @vuvanhieu143. Looks like it works. This has been mentioned in the forums and in another issue but I could not replicate it so I appreciate you coming up with a solution and a PR.
Thanks, @mdjnelson ,I will submit a PR and behat scenario for this case later.
Hi @mdjnelson , I have submitted a PR
Cherry-picked, thanks for your contribution!
This problem has reappeared in version 4.0+
Hi @mdjnelson , I found out there will be an error when we have custom fields in user profile This code should include the join and params for custom fields.
$ufields = \core_user\fields::for_userpic()->including(...$extrafields); $ufields = $ufields->get_sql('u', false, '', '', false)->selects; $sql = "SELECT $ufields, ci.id as issueid, ci.code, ci.timecreated FROM {user} u INNER JOIN {customcert_issues} ci ON u.id = ci.userid WHERE u.deleted = 0 AND ci.customcertid = :customcertid $conditionssql"; if ($sort) { $sql .= "ORDER BY " . $sort; } else { $sql .= "ORDER BY " . $DB->sql_fullname(); }
These are the code changes that will fix this issue.
$ufields = \core_user\fields::for_userpic()->including(...$extrafields); [ 'selects' => $userfieldsselects, 'joins' => $userfieldsjoin, 'params' => $userfieldsparams ] = (array) $ufields->get_sql('u', true);
Sorry, I can't submit a PR right now because I'm busy with my work. I will submit a PR later.
Could you please take a look and give me your thought on this issue.