Changing usernames using MySQL query - is it safe?

Changing usernames using MySQL query - is it safe?

by Conor Bradley -
Number of replies: 1

We've moved to Open ID authentication but have run into an issue to how usernames relate to an external database we use for enrolment information.

New students without a moodle account get a new account with username 

0011223@students.college.ac.uk

But existing students logging in with Open ID for the first time keep their existing username of

0011223

This causes us issues when moodle does it's external database enrolment because all the usernames are in the format

0011223@students.college.ac.uk

I'm considering doing a MySQL query to change all the existing "0011223" users to "0011223@students.college.ac.uk".

Can anyone advise me whether there's any dangers inherent to this change?

Average of ratings: -
In reply to Conor Bradley

Re: Changing usernames using MySQL query - is it safe?

by Conor Bradley -
Have an update on this one - if you make this change in SQL by editing the mdl_user table to change username make sure you edit the mdl_auth_oidc_token table username column to match or delete the existing entries in it. Without this you'll get login errors for users with existing tokens.