XF 2.1 Registration, avoid strange names

Robert9

Well-known member
I can use a regex to have better usernames; but this decrease the number of registrations.

Some easy rules would help much better:

substitute everything else than 0-9, a-z, A-Z and (_-) with nothing
strtolower
ucfirst
replace all (-)+ > 1 to -
replace all (_)+ > 1 to _

Probably there will be another 100 updates to xf2; so i dont want to change the code itself.
Is there any addon handling with registering to add these small rules maybe?
 
Last edited:
I can use a regex to have better usernames; but this decrease the number of registrations.

Some easy rules would help much better:

substitute everything else than 0-9, a-z, A-Z and (_-) with nothing
strtolower
ucfirst
replace all (-)+ > 1 to -
replace all (_)+ > 1 to _

Probably there will be another 100 updates to xf2; so i dont want to change the code itself.
Is there any addon handling with registering to add these small rules maybe?
/admin.php?options/groups/usersAndRegistration/ -> User name match regular expression:
I use: [A-Za-z0-9]+(?:[ _-][A-Za-z0-9]+)*$
 
Yes, shure. Thank you.
But this is no real good solution for me, because you force your users to find a correct version of a username.
You also need some hints for your regex.

I like the idea to "replace" some things to build the correct username.
 
Back
Top Bottom