How can I stop users from creating user names like this?
https://i.sharefa.st/IiXrEEiuwXr2.png
Printable View
How can I stop users from creating user names like this?
https://i.sharefa.st/IiXrEEiuwXr2.png
You can use regular expressions
Enviado desde mi iPhone utilizando Tapatalk
First go to app/ and open class.users
Find this function:
and replace that with this:Code:final public function validName($username)
{
if(strlen($username) <= 25 && ctype_alnum($username))
{
return true;
}
return false;
}
That code ^ only allows A-Z and numbers, you can change it to and have people still sign up with "-" if you'd like, you would just have to change the "/^[a-zA-Z0-9]+$/" to something else.Code:final public function validName($username)
{
if(strlen($username) <= 25 && preg_match("/^[a-zA-Z0-9]+$/", $username))
{
return true;
}
return false;
}
underscore, dash, alphanumCode:final public function validName($username)
{
if(strlen($username) <= 25 && preg_match('/[^\w-]/', $string))
{
return true;
}
return false;
}