ndunand / moodle-enrol_attributes

This plugin allows users to be enrolled according to any value stored in their user profile.
https://moodle.org/plugins/enrol_attributes
18 stars 22 forks source link

The RIGHT JOIN in process_enrolments can break CRON #48

Closed kingdavid127 closed 10 months ago

kingdavid127 commented 2 years ago

The only returned value from the query in process_enrolments is the DISTINCT u.id from the user table. In some cases the RIGHT JOIN causes it to return NULL as one of the values. This crashes the cron when enrol_user is called with NULL for the user->id.

Changing RIGHT JOIN to just JOIN fixed the issue on a client's site that encountered this problem.

kingdavid127 commented 2 years ago

https://bitbucket.org/mylearningconsultants/enrol_attributes/commits/e2d0520643c0d4a221fe2c2eb30ae7ed171e9ce2#chg-lib.php

NicoAlexH commented 10 months ago

Hello @kingdavid127, the right join was indeed a mistake, I just fixed the query. Thank you very much and sorry for the late answer !