It can be difficult to remember all of the usernames and passwords that you use to log in to various websites across the internet, so why force users to create a new username for your web site? It's easier on everyone to simply combine the username and email address fields. It also cleans up your registration form a bit.
In Drupal, there are two modules that can help you to accomplish this:
These two modules are mutually exclusive— they are not compatible with each other, so you'll have to pick one. I prefer to use Email Registration, and I'll explain why.
Email Registration simplifies the user registration form by removing the 'username' field. By default, the module will automatically generate a username for a new user based upon the first part (before the @) of his/her email address. For example, if I registered for a new account with email address [email protected], I would end up with username madmatter23.
That's great, but it's not exactly what I'd like. I'd like my username to be my full email address. Luckily, Email Registration provides a hook_email_registration_name() to let you customize exactly how the username will be generated. I used the hook in this way:
/* * Implements hook_email_registration_name(). */ function grasmash_email_registration_name($edit, $account) { return $account->mail; }
Adding a similar snippet to your own custom module will give you complete control. That's all there is to it!
This module still forces users to choose their own username during registration. However, after they're registered, it will allow them to login using either their username or their email address. Hence my preference for Email Registration.
LoginToboggan also has a number of other nice features, such as redirecting users after registration or login, and providing a login form on the 403 Access Denied page. If you really need one of these features, there are a number of alternative modules that provide the same functionality:
Using this method does have at least one major drawback: you no longer have the option to display a user's username while preserving the privacy of their email address. However, this problem can easily be circumvented by simply using an optional 'alias' field, or by utilizing a programmatically applied handle for users based on other field values.

Comments
Perry Prabhat Jain
Thu, 12/29/2011 - 22:59
Permalink
Good One!
Thanks for sharing.
However, It did not work for me for D7.
I have created an issue here: http://drupal.org/node/1389080.
Perry.
madmatter23
Fri, 12/30/2011 - 06:44
Permalink
Perry
Try these steps:
Let me know if that works!
Everett Zufelt
Fri, 12/30/2011 - 01:35
Permalink
Drupal 8.x patch
Nice description of the available options.
I'd encourage anyone interested in seeing this functionality in Core to visit http://drupal.org/node/111317 where there is a patch needing review.
The patch allows admins of Drupal 8.x sites to choose how users can log in (email only, username only, email or username).
Thanks.
Gareth Price
Thu, 01/05/2012 - 05:58
Permalink
LoginToboggan + String Override
My solution in the past has been to use LoginToboggan to allow e-mail logins, then use String Override to rename the "Username" field to "Full Name". As Drupal supports spaces in usernames, a name like "Gareth Price" is valid and can be safely displayed to the public.
Ken Ficara
Tue, 02/28/2012 - 07:50
Permalink
What about John Smith
What do you do when the second John Smith tries to register on the site?
madmatter23
Sun, 03/04/2012 - 21:46
Permalink
Shouldn't be a problem
The email registration module will ensure that user account names are kept unique by applying an integer to the end of the user name string.
Anonymous
Mon, 01/14/2013 - 01:08
Permalink
Yeah.I can not agree with you
Yeah.I can not agree with you anymore. I thank you for sitting down imparting your musings and thoughts to a considerable measure of bookworms over there. http://www.mmoxe.com/FFXI/
star7690
Tue, 05/21/2013 - 03:43
Permalink
[email protected]
This posting is marvelous and what a fantastic research that you have done. It has helped me a lot. thank you very much. Feel free to visit my buy portfolio lighting site. http://www.bestcustomwriting.com/topic-ideas/research-paper/research-pap...
Josh Lind
Thu, 01/05/2012 - 14:17
Permalink
This has always been my solution too.
The vast majority of sites I've worked on have fallen under the category of no need for a username.
No one wants to remember a username, when you can just use your email and a password.
BTW: There is also Shared Email if you like to allow people to create multiple accounts (not be stopped by re-using an email for sales lead reasons).
Ed McL
Wed, 01/25/2012 - 12:42
Permalink
Email Registration module has a bug
The Email Registration module appears to have a bug (or perhaps it's a feature.) According to the module page:
In practice, however, the username ends up being a random string.
More here: http://drupal.org/node/1410844
kaizerking
Thu, 02/09/2012 - 07:32
Permalink
username
i was looking for auto generation of a "random name" 'or "number" (not UID)and assign it to user during registration or after registration (like Avtar) , my intention is to protect identity of the user when user is participating in discussion forums or groups.By no means user should be able to disclose the identity, if i allow user to create user name almost 50% of users will choose a name will choose with their first name or lat name or name resembling to either of them, i want to prevent that.
Janneaa
Thu, 03/01/2012 - 03:39
Permalink
Thanks
Thank you for the informative review! I've also decided to go with Email Registration.
The separate username field should really be optional in Drupal core.
CHANDRA
Tue, 05/08/2012 - 03:42
Permalink
thanks for sharing this,it
thanks for sharing this,it helps me a lot
Johnathan
Fri, 09/07/2012 - 15:03
Permalink
Email Registration & LoginToboggan together
I was able to use these modules together. First enable LoginToboggan and configure how you like, EXCEPT you need to Disable using the e-mail address on the login screen. After that, you can enable Email Registration. It worked great for me.
Lise Andreasen
Fri, 01/11/2013 - 02:51
Permalink
Illegal user names allowed
Using email registration + code snippet above, it's possible to create users with illegal user names. When this user is updated, an error is reported.
Anonymous
Sat, 03/02/2013 - 13:35
Permalink
email registration + code
email registration + code snipped above + pathauto can take care of puncuations as @ and . at admin/config/search/path/settings.
Demaemiainekstz
Tue, 05/21/2013 - 18:09
Permalink
Xorauguynawymge
DogeHilerNero <a href="http://vikaswieier.com">xaikalitag</a> greefulse http://usillumaror.com - iziananatt shertyIrrargy http://gussannghor.com Playclaro
Add new comment