I'm trying to get allow only lowercase usernames are valid usernames in my wordpress blog. I managed to write a function but it does not seem to work.
add_filter('validate_username' , 'simple_user', 1, 2);
function simple_user($valid, $username ) {
if (preg_match("/[a-z0-9]+/", $username)) {
// there are spaces
return $valid=false;
}
return $valid;
}
Any ideas with getting this to work ? i tried this but it never worked. I will be very appreciative if someone could help me with this one. Thank you