WordPress.org

Ready to get started?Download WordPress

Forums

Allowing registration with the email as username (7 posts)

  1. Stefano Garuti
    Member
    Posted 5 years ago #

    For a customer I need to enable the registration with only the email address provided, so it acts as username too.

    I tried to hook in to the registration steps in this way:

    function email_as_username ($user_login="", $user_email="", $errors=""){
    	$user_login = $user_email;
    	return $user_login;
    }

    add_action ( 'register_post', 'email_as_username', 10, 3);

    but the $user_login variable isn't returned to the calling wp-login.php script even if I try to set $user_login as global variable inside the function.

    Another problem is that the "register_post" action hooks in wp_login.php AFTER that wp added to the $errors object the "empty username" error.
    So in the same "email_as_username" function I need to unset that error code, but the WP_Error class doesn't seems to provide such a "remove" method.

    Any hint or suggestion? Other way to go?

    TIA
    Stefano

  2. poopadupes
    Member
    Posted 5 years ago #

    I'm look for the same thing.. Any help would be much appreciated.

    @Garubi, after some digging I may have found something than can help:
    http://www.askapache.com/wordpress/register-user-registration-form.html
    I don't want users to create their own password (prefer using WordPress's generated password) but this should show you how to pass email as username.

    I'm not really good w/ php so if you figure out how to do this, can you help me as well?

  3. modifiedcontent
    Member
    Posted 5 years ago #

    I'm looking for the same thing. I want to get rid of silly anonymous usernames. I want to let members sign up with just their real full name + email address and send password in the confirmation email. Whereever the username is used as default, I want to show the full real name or the first name.

    For sign-up/login: email address = username
    For the rest of the site: username = real name

    What is the least intrusive way to achieve this?

  4. modifiedcontent
    Member
    Posted 5 years ago #

    Does anyone have any ideas?

  5. modifiedcontent
    Member
    Posted 5 years ago #

    Anyone?

  6. modifiedcontent
    Member
    Posted 5 years ago #

    Beau Lebens actually wrote a cool little plugin for this that actually seems to work!!

    You still have to enter a username during registration. Activation emails still instruct the new member to log in with that username, where they in fact now have to use their email address.

    So you have to make some edits to the forms and email messages, but that's no problem. The cool thing about this plugin is that it seems to take care of the tricky stuff in an unobstrusive way.

    Happy! :-)

    Doing further testing...

  7. kiranthomman
    Member
    Posted 4 years ago #

    This plugin still requires you to enter a user name. What I want just like garubi does is to just have users enter their email and then using the register_post hook make the variable for the username fetch its value from th email id variable and then pass it on to wp_login.php. But I did make a plugin just like garubi did and strangely the function does not return the value in wp_login.php for $user_login can anybody help out?

Topic Closed

This topic has been closed to new replies.

About this Topic