Is there anyway I can remove all instances of the username in all WP emails, or swap our the username for the email address?
I have some code in my functions.php
file that removes the username from the registration and uses the email as the login, but it makes it so the username is randomly generated; that means all emails going out to the user that contain a username field will get username: random-string-of-letters, which I'm trying to remove/swap.
Below is code removing the username from registration:
add_action( 'bp_core_validate_user_signup', 'custom_validate_user_signup' );
function custom_validate_user_signup($result)
{
unset($result['errors']->errors['user_name']);
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;
}