filiped
Member
Posted 3 years ago #
Hi,
I'm integrating my wordpress login with a mIRC client.
Since IRC does not support space characters or any other special characters at names, I would like to know:
How to prevent user to create accounts with spaces and special characters in their usernames?
Best regards.
Filipe Deschamps
filiped
Member
Posted 3 years ago #
filiped
Member
Posted 2 years ago #
ravisarma
Member
Posted 2 years ago #
I am just guessing here, so please use caution:
In wp-includes/formatting.php is a function sanitize_user() -- perhaps that's the place you should start looking. That the file is named formatting.php gives me pause... perhaps the class WP_User is where you should add your code. If you are not PHP proficient, you can ping me, and I can try to figure out the exact spot to add relevant code.
Also, have you checked to see if a plug-in already exists that implements this?
filiped
Member
Posted 2 years ago #
ravisarma,
Unfortunately, there's no plugins to prevent space character in usernames.
I have some knowledge with php, but I'm to scared to mess up with core files due to upgrading problems.
I still couldn't find a solution for this.
In the Plugin API/Filter Reference, you will find a brief mention of pre_user_login that is applied to a user login before saving in the DB. Perhaps you can use that to screen out special characters.