Hi,

Regarding username generation, is there a way to set it so that the username is all lowercase? A user can log in (case insensitive username) but the username displayed in posts is in the format of first and last initials in uppercase and the rest in lowercase.

Current output: "John" + "Smith" => "JSmith".
Desired output: "John" + "Smith" => "jsmith".

Thanks.

Comments

nicholasthompson’s picture

+ 1 for me....

Should be quite a simple patch in the sanitize username function...

ambereyes’s picture

Make the following change in user_import.module

function _user_import_sanitise_username($username) {
  
	// username cannot contain an illegal character
	$username = preg_replace('/[^a-zA-Z0-9@ ]/', ' ', $username);
	// username cannot contain multiple spaces in a row
	$username = preg_replace('/[ ]+/', ' ', $username);   

	// username must be less than 56 characters
	$username = substr($username, 0, 56);

	// username cannot begin or end with a space
	$username = trim($username); 
	
	// username must be all lower case
	$username = strtolower($username);
	
	return $username;
}

Katrina

--
www.ambereyes.net

Mel55113’s picture

Actually I prefer the current mode of operation, e.g. John Smith becomes JSmith. I think it's much easier to read and gives a more polished look.

Since in use the username (or email address if you use login toboggan; highly recommended) is inherently case insensitive it really doesn't matter to the user at login time.

Therefore, if you implement this request, please make it optional.

Thanks,
Mel

robert castelo’s picture

Status: Active » Closed (won't fix)

Would be fairly easy to add this but I think unnecessary.

The more options we add the more confusing the UI becomes - if someone really wants this they can add it in a custom module and use User Import's API to add the feature.