WordPress.org

Ready to get started?Download WordPress

Forums

Simple email register form (2 posts)

  1. tee05
    Member
    Posted 2 years ago #

    Does anyone know if there is a way to add a simple register form with only the email address feild and this then creates a new user? (In other words no username or password in the register form.)

  2. Daniel King
    Member
    Posted 2 years ago #

    I tried this just now for an event related site. It's 100% hacky, but on wp_login.php, about line 298, I added a $user_login = $user_email:

    function register_new_user( $user_login, $user_email ) {
    	$errors = new WP_Error();
    	$user_login = $user_email;
    
    	$sanitized_user_login = sanitize_user( $user_login );

    This makes the login field data irrelevant, and replaces with the email address. Then, it sanitazes and continue with the registration process.
    Then, you should remove or hide the user_login text field
    I'm not sure if it's the best way to do it, but it works for now.

    It's important to note that I made this form not available for the general public, it just for event organizers.

Topic Closed

This topic has been closed to new replies.

About this Topic