Using your email address as your Drupal username

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

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:

<?php /* * 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:

Final Thought

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.

In reply to by Perry Prabhat Jain

Try these steps:

  1. Clear your caches after adding the hook.
  2. Add the hook to a custom module rather than to your template.php file.

Let me know if that works!

In reply to by grasmash

You can only perceive real beauty in a person as they get older.
<a href="">Buy YouTube Views</a>

In reply to by sidra

I am not sure if this is actually the best place to ask but do you folks have any ideea where to hire some professional writers? Thanks in advance | | |

In reply to by grasmash

Thanks for sharing this useable article - I really increase your is really very informatic post for young people, and hope they will enjoy well after reading this post.
<a href="">garcinia cambogia side effects</a> | <a href="">where can i buy garcinia cambogia</a> | <a href="">buy garcinia cambogia extract</a> | <a href="">garcinia cambogia customer reviews</a>

In reply to by Perry Prabhat Jain

You can't really say what is beautiful about a place, but the image of the place will remain vividly with you.
<a href="">SEO Manchester</a>

In reply to by Perry Prabhat Jain

I have read so many article of this site in which some of them were very intresting and inspiring.This article has good title with good description.

<a href="">garcinia cambogia dosage</a>
<a href="">does garcinia cambogia really work</a>
<a href="">what stores sell garcinia cambogia</a>
<a href="">natural garcinia cambogia</a>
<a href="">Garcinia cambogia benefits</a>
<a href="">garcinia cambogia</a>

Nice description of the available options.

I'd encourage anyone interested in seeing this functionality in Core to visit 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).


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.

In reply to by Ken Ficara

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.

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).

The Email Registration module appears to have a bug (or perhaps it's a feature.) According to the module page:

A username is generated and assigned based on the user name part of the email address. Subsequent users who have the same name (email prefix) are numbered sequentially. For example, "[email protected]" would be assigned username "johndoe", "[email protected]" would be assigned "johndoe001" and so forth.

In practice, however, the username ends up being a random string.

More here:

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.

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.

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.

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.

In reply to by Lise Andreasen

We help leaders make distinctive, lasting and substantial enhancement to the performance of their organizations.Buy YouTube Views

In reply to by eavedrop44

I will be interested in more similar topics. i see you got really very useful topics , i will be always checking your blog thanks. SEO Liverpool

email registration + code snipped above + pathauto can take care of puncuations as @ and . at admin/config/search/path/settings.

In reply to by Anonymous

Wow, this is pretty interesting. Inspiring, as well. Thanks for sharing such inspiring experience with us. Great blog, congrats.!Life Insurance Policy

When you're a carpenter making a beautiful chest of drawers, you're not going to use a piece of plywood on the back, even though it faces the wall and nobody will ever see it. You'll know it's there, so you're going to use a beautiful piece of wood on the back.
<a href="">Buy Instagram Followers</a>

I want to thank you for this informative read; I really appreciate sharing this great.

garcinia cambogia extract

garcinia cambogia supplement

garcinia cambogia dosage

Frankly, we haven't analyzed this to the point that we stand firmly on that calculation. But from Edge Studio's perspective as a premier voice production and training facility, we can attest that, for many reasons, the voice over field continues to grow, and the need for voice over talent is booming.

This website has very good content. Thank you for the great article I did enjoyed reading it, I will be sure to bookmark your blog and definitely will come back from again.
Stilnox Online

Thanks totally agree with this article and just want to say that the article was very good and very informative article.I ensure reading
<a href="">garcinia cambogia dosage</a>
<a href="">does garcinia cambogia really work</a>
<a href="">what stores sell garcinia cambogia</a>
<a href="">natural garcinia cambogia</a>
<a href="">Garcinia cambogia benefits</a>
<a href="">garcinia cambogia</a>

I have been seeking information on this topic for the past few hours and found your post to be well written and has solid information. Thx.
[url=]garcinia cam]garcinia cambogia dosage[/url]
[url=]does garcinia cambogia really work[/url]
[url=]what stores sell garcinia cambogia[/url]
[url=]natural garcinia cambogia[/url]
[url=]Garcinia cambogia benefits[/url]
[url=]garcinia cambogia[/url]

I got what you intend, thankyou for putting up.Woh I am glad to find this website through google. It is a very hard undertaking to seek to please everybody. by Publilius Syrus. abkffde

The social networks become more popular, their role in the classroom has befall below scrutiny. Drupal provides a wide variety of useful tools for educators. Interior a single drupal site, you can determined up social bookmarking, podcasting, video hosting, official moreover informal groups, rich user outlines, moreover additional features usually associated accompanying companionable web communities.

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.