function domain_user_strip_chars in Domain Access 6.2
Same name and namespace in other branches
- 5 domain_user/domain_user.module \domain_user_strip_chars()
Turn a user name into a domain-safe string.
Parameters
$name: The user name to process.
Return value
A string with only alphanumeric characters and dashes.
1 call to domain_user_strip_chars()
- domain_user_user in domain_user/
domain_user.module - Implement hook_user()
File
- domain_user/
domain_user.module, line 291 - Creates unique subdomains for registered users.
Code
function domain_user_strip_chars($name) {
// Only alphanumeric characters are allowed.
$pattern = '/[^a-zA-Z0-9]/';
$name = preg_replace($pattern, '-', $name);
return strtolower($name);
}