moodle-an-hochschulen / moodle-local_bulkenrol

Moodle plugin which provides the possibility to bulk enrol a list of users who are identified by their e-mail adresses into a course.
5 stars 17 forks source link

please add support for case insensitivity matching #35

Open michaelnguyen-creative opened 3 weeks ago

michaelnguyen-creative commented 3 weeks ago

Suggestion: Transform both the email inputs from users & moodle user email to lowercase before performing matching, or include a setting for that

Context: We have been experiencing issues with exact matching method for moodle users with case sensitive emails, for example: Abc@example.com, abc@example.com, ABc@examPle.com etc. should match a single user in moodle instead of matching different users

Thank you

zyxSheila commented 1 week ago

Hi Michael,

I met this issue as well so I have to change the codes in this line to get users via $userrecords = $DB->get_records_sql('SELECT * FROM {user} WHERE LOWER(email) = LOWER(:email)', array('email' => $email));

Hope this is useful to you as well.

michaelnguyen-creative commented 1 week ago

I’ll definitely try that one—thank you so much, Sheila!