The project page mentions the automatic account name creation by taking the first part of the email address.
This does not occur however, the account name created is a random set of characters, i.e. onvUp7moby
This random account name appears everywhere in the site, and is very user unfriendly.
I need the account to show the (first part of the0 email address as username.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | email_registration_fix_1.patch | 2.37 KB | spleshka |
| #1 | email_registration_fix.patch | 3.5 KB | spleshka |
Comments
Comment #1
spleshkaI've got the same issue.
hook_user_insert() works not properly in your case. It's better to change user name on submit callback. That works for me. Patch attached.
Comment #2
spleshkaIf you wanna to save hook_email_registration_name() you should use this patch.
Comment #3
andypostThis way is wrong, deprecating hook_user_insert() will kill ability to generate names by fedds and programmatic way
suppose you should dig deeper and find a real cause of the error
Comment #4
spleshkaBut why can't I use my method? Is it wrong?
Comment #5
andypostYou could implement hook_email_registration_name() in custom module to generate a user name as you need
Comment #6
spleshkaAndy, please pay attention at the second patch. I kept possibility to implement hook_email_registration_name().
Comment #7
andypostas I said - users could be created by migrate|feeds or other programmatic way so this hook is required!
Also your patch removes this general ability
Comment #8
spleshkaSure, because Drupal will make it for me. If email verification is disabled I will be logged in automatically without this peace of code.
Comment #9
gregglesMy sense is that the key part is:
That should let this code run very early in the registration process (before hook_user_insert is called) so that this module can generate a more reasonable username quickly.
I've updated the title to reflect that idea. I am not affected by this issue personally but am open to the change as long as it maintains the ability to override the name change via hook_email_registration_name.
Comment #10
gregglesWell, that said...this needs to work also with sites that create user's via user_save instead of the registration form so it will need to be smart about doing both.
Comment #11
gregglesMarked #1410994: Flaw in when the username gets created as a duplicate. It has the idea that some of this module's code should be moved to a validate hook for the form-based user creation so that it runs even before the submit function. As I think about that more, I think that just making this module's submit handler the first is the best idea.
Comment #12
kevin.klika commentedgreggles, how would you resolve this issue? When using email_registration for standard registration, everything works fine -- however when I use it with drupal commerce (commerce kickstart, to be specific), this problem rears it's head. Every user gets an email with their new username (correct), then another email that specifies a random username. (in fact, now all of my users get a username like "email_registration_[random-characters]").
Is there a weight I can modify or something I can do to prevent this 'secondary' username generation?
Comment #13
gregglesI don't think this issue is the right one to resolve that problem. Can you create a new issue?
Comment #14
kevin.klika commentedsorry greggles, this is the exact issue I am having. I think I explained it poorly. Is there a patch against the current dev version to change these hooks? I can't get this module to work without it setting a random string as the username -- user even gets two emails -- one correct and one wrong. Even more oddly, the correct email comes first and the wrong one is sent after:-x
Comment #15
gregglesI created #1899720: Support commerce setting to create users during checkout. As I said there it's probably worth saying here - I'm not affected by this bug so I don't plan to work on it but I am happy to review a patch.
Comment #16
bluegeek9 commentedDrupal 7 is End of Life. We recommend upgrading to a supported version of Drupal.