• Resolved promosweb

    (@promosweb)


    Hi guys,
    I need to use email field like username is possible?

    I need a registration form with:
    email (username)
    password
    fieldA
    fieldB
    fieldC

    Now I used only email field but username is only a part of email, example:
    email: [email protected]
    user: jason

    is possible have full email address?

    • This topic was modified 3 years, 7 months ago by promosweb.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Amrit Kumar Shrestha

    (@shresthauzwal)

    Hi @promosweb,

    Thank you for writing in,

    Currently, we do not have a feature to generate the user name same as the email. According to the plugin feature, we have the feature to auto-generate the username according to the prefix of the email. However, we will surely think about it and maybe we will introduce this in the future. We will make sure to let you know once the feature is out there.

    Let me know if you have any other questions and I will get back to you.
    Regards!

    Plugin Support Amrit Kumar Shrestha

    (@shresthauzwal)

    Hi @promosweb,

    We tested with few code snippet, and it working fine here, please add the following code on your theme’s functions.php file, or you can use the code snippet plugin.

    add_action( 'user_registration_after_register_user_action', 'ur_insert_username', 1, 3 );
    function ur_insert_username( $valid_form_data, $form_id, $user_id ) {
    global $wpdb;
    $user_login = $valid_form_data['user_email']->value;
    $wpdb->update( $wpdb->users, array( 'user_login' => $user_login ), array( 'ID' => $user_id ) );
    }
    add_filter( 'user_registration_before_register_user_filter', 'ur_set_email_as_username', 10, 2 );
    function ur_set_email_as_username( $valid_form_data, $form_id ) {
    $valid_form_data['user_login'] = $valid_form_data['user_email'];
    return $valid_form_data;
    }

    Regards!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘email and user same field’ is closed to new replies.