Orit
Active member
Hello
Quite a few of our users are recently changing their usernames to usernames containing emojis and other unicode characters.
Is there a way to prevent that?
I don't really mind them using those characters, but we get server errors regarding those changes:
Thanks!
Edit:
I found @AndyB suggestion to use regex. The problem is our board is not in English and we allow other language characters. I can't seem to generate a correct regex containing them too...
Quite a few of our users are recently changing their usernames to usernames containing emojis and other unicode characters.
Is there a way to prevent that?
I don't really mind them using those characters, but we get server errors regarding those changes:
XF\Db\Exception: MySQL query error [1267]: Illegal mix of collations (utf8mb3_general_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation '='src/XF/Db/AbstractStatement.php:230
Thanks!
Edit:
I found @AndyB suggestion to use regex. The problem is our board is not in English and we allow other language characters. I can't seem to generate a correct regex containing them too...
If you would like to only allow modern English alphabet, numbers and space in usernames, you can use the "Username match regular expression" field in the admin control panel:
Admin control panel -> Setup -> Options -> User registration
View attachment 263326
Enter the following:
/^[a-z0-9 ]+$/i