When you've chosen not to include spaces in usernames, it would make sense not to include spaces when adding a numeric suffix on to disambiguiate duplicate usernames.

Spaces in usernames is something you don't see much in software other than Drupal. I'd recommend that when a duplicate username is found, that the numerical suffix concatenated to the end of the new username does not have a space in front of it.

I'm working with a site that automatically creates a Google Account when a new user is created. Google errors out when there are spaces in the username... Just an example of why sticking with the more standard "no space username" is probably a good idea.

I see two ways to do this:
1. Change the code that checks and builds usernames in _user_import_unique_username().
2. Add the $username_space value as a parameter on _user_import_unique_username() as $username_space is available in _user_import_create_username() where _user_import_unique_username() is called, and tie the space/no space behavior into that, so the user can decide.

CommentFileSizeAuthor
#1 user_import-631408-1.patch1.05 KBmlsamuelson
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mlsamuelson’s picture

Status: Active » Needs review
FileSize
1.05 KB

Here's a patch that takes the option 1 approach.

gisle’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev
Issue summary: View changes
Status: Needs review » Needs work
Related issues: +#534958: When not allowing spaces between username parts, remove all spaces

Adding #534958: When not allowing spaces between username parts, remove all spaces as a related issue.

When re-rolling these against the latest version (7.x-3.x), these should be fixed in concert.

I am not signing up for this yet, as I have more urgent matters to attend to, but will make a stab when I can find the time.