How do I remove the required "username" field from registration?

Need to figure out how to take off the username field on registration...

  • Vinod Dalvi
    • WP Unicorn

    Hi @Ethan,

    I hope you are well today and thank you for your question.

    Add following code in functions.php file of buddypress theme which will use user email in place of user name.

    add_action( 'bp_core_validate_user_signup', 'custom_validate_user_signup' );
    function custom_validate_user_signup($result)
      if(!empty($result['user_email']) && empty($result['errors']->errors['user_email']))
        $result['user_name'] = md5($result['user_email']);
        $_POST['signup_username'] = $result['user_name'];
      return $result;

    Remove following code from line number 32 in buddypress template file buddypress/members/register.php to remove user name field from registration form.

    <label for="signup_username"><?php _e( 'Username', 'buddypress' ); ?> <?php _e( '(required)', 'buddypress' ); ?></label>
    <?php do_action( 'bp_signup_username_errors' ); ?>
    <input type="text" name="signup_username" id="signup_username" value="<?php bp_signup_username_value(); ?>" />

    Best Regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.