To check that usernames only have letters, numbers, and spaces, find the
usernamevalidate() function in
classes/class_registervalidator.php and replace the function with this:
PHP Code:
protected function usernamevalidate($username = ""){
// The username validator, note its a bit complicate here due to the different mechanism of username check for register and other validators
$lang = Registry::get("lang");
if(!$this->emptyvalidate($username)){
$this->seterror("The field Username is Empty.");
return FALSE;
}
if(preg_match('#^[A-Z0-9 ]+$#i', $username) == FALSE){
$this->seterror("Usernames can only contain letters, numbers, and spaces.");
return FALSE;
}
$username = (empty($username))?$this->value['username']:$username;
$userexist = $this->datavalidate("users", array("username"), "username = '{$username}'");
if($userexist == TRUE){
$this->seterror($lang->user);
return FALSE;
}
else return TRUE;
}