What's the easiest way to prevent spaces in the user name field?
What's the easiest way to prevent spaces in the username field?
I looked for an extension or something, and it appears there is not something available.
I looked for an extension or something, and it appears there is not something available.
0
This discussion has been closed.
Comments
<?php /* Extension Name: Space Username Check Extension Url: http://lussumo.com/community/discussion/8033/whats-the-easiest-way-to-prevent-spaces-in-the-user-name-field/#Item_0 Description: Prevents users from registering duplicate accounts with a space in the username. Version: 1.0 Author: WallPhone Author Url: http://WallPhone.com/ */ if ('people.php' == $Context->SelfUrl) { $Context->SetDefinition('NoSpacesAllowed', 'The username may not contain a space.'); Function SpaceUsernameCheck(&$UserManager) { $u = &$UserManager->DelegateParameters['User']; if (stripos($u->Name, ' ')) $UserManager->Context->WarningCollector->Add($UserManager->Context->GetDefinition('NoSpacesAllowed')); } $Context->AddToDelegate('UserManager', 'PostValidation', 'SpaceUsernameCheck'); }