This issue is very similar to the final patch in #1242156: illegal username character. I'd like to see us using the first initial and last name of a customer name to create a username for use during anonymous checkout completion / account creation instead of the e-mail address (or at least as an alternative). View the patch there to see how I added this computed property to order entities; the patch for customer profiles will require the same integration. We should consider what to do about username collision, too, in the event that two anonymous customers with the same name create an account on the site. It should be intelligent enough to allow the same username for orders using the same user account e-mail address.
I'm not sure if we should make this new token the default for Commerce 1.x, as it would change the default account creation behavior for all existing sites, but that probably isn't a huge deal. Sites wanting to continue using the e-mail address can be instructed to use the old token.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | commerce-Add_customer_profile_username_property-1444696.patch | 2.11 KB | marcin.wosinek |
Comments
Comment #1
alyssaengleson@aimclear.com commentedComment #2
alyssaengleson@aimclear.com commentedComment #3
alyssaengleson@aimclear.com commentedComment #4
jacknely commentedAny developments with this?
I really need a solution/workaround quick
Comment #5
marcin.wosinek commentedI've started working on patch.
Right now it adds new property "auto-username" which contains all but last initials, and last name. It works for both name inputs (Single line and First name, Last name).
commerce_order_get_properties, just before returning is correct place to put logic for this?Just before creating new user we check if hers email is already registered, so it seems to me that we don't need to care about it.
Other thing is that we should fallback to use email-based username if there is no name in customer address.
Comment #6
joshmillerPatch would not apply. Here's my thought: If we're going to generate an automatic username, we have a *lot* to think about. This long list of valid usernames that are somewhat strange:
And while core has rules about what can be in a username, it doesn't actually convert any names. This makes converting given names, Commerce's problem.
Additionally, if we add one small feature like this, someone is liable to dislike whatever we choose as the way the username is generated. So, I would like to see this token have a configuration screen that creates a pattern that we can use to generate the actual username (ugh!).
Or ... people could just use http://drupal.org/project/auto_username module and be done with it?
Josh
Comment #6.0
joshmillerAdding clarification on the checkout completion rule update.