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!
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!