cbluesprl / moodle-mod_linkedincert

This plugin allows you to create certificates that can be automatically linked to a linkedin account.
2 stars 1 forks source link

Fixed linkedinCert for Moodle 4.3 #3

Open adminGPTeach opened 6 months ago

adminGPTeach commented 6 months ago

I've fixed the issue with get_all_user_name_fields() being deprecated and the need to use the \core_user\fields API instead. To resolve this issue in your setup, all you need to do is replace the necessary changes. Simply add use core_user\fields; at the beginning of the file and replace the following part around line 99: or change from this: $userfields = get_all_user_name_fields(true, 'u'); $sql = "SELECT ci.id, u.id as userid, $userfields, co.id as courseid, co.fullname as coursefullname, c.id as certificateid, c.name as certificatename, c.verifyany FROM {linkedincert} c JOIN {linkedincert_issues} ci ON c.id = ci.linkedincertid JOIN {course} co ON c.course = co.id JOIN {user} u ON ci.userid = u.id WHERE ci.code = :code";

to this:

$userfieldssql = \core_user\fields::for_name()->with_userpic()->get_sql('u', false); $sql = "SELECT ci.id, u.id as userid, " . trim($userfieldssql->selects, ', ') . ", co.id as courseid, co.fullname as coursefullname, c.id as certificateid, c.name as certificatename, c.verifyany FROM {linkedincert} c JOIN {linkedincert_issues} ci ON c.id = ci.linkedincertid JOIN {course} co ON c.course = co.id JOIN {user} u ON ci.userid = u.id WHERE ci.code = :code";

tecnologia-acceleralia commented 3 weeks ago

Not fixed yet in master.

https://github.com/cbluesprl/moodle-mod_linkedincert/blob/24e2a4adffc4e6287dba12029e68964c903dde28/verify_certificate.php#L100

image