You can add the username to the activation e-mail by adding this code either to the bp-custom.php
or to the theme’s functions.php
file
add_filter('bp_core_signup_send_validation_email_message', 'add_username_to_activation_email',10,3);
function add_username_to_activation_email($msg, $u_id, $activation_url) {
$username = $_POST['signup_username'];
$msg .= sprintf( __("After successful activation, you can log in using your username (%1\$s) along with password you choose during registration process.", 'textdomain'), $username);
return $msg;
}
EDIT: You are right, if the user used a space in his username, Buddypress will not show him an error and the registration process will continue. The next time user tries to log-in using his username with a space, the log-in process will fail. So we have to replace $username = $_POST['signup_username']
as follows:
add_filter('bp_core_signup_send_validation_email_message', 'add_username_to_activation_email',10,3);
function add_username_to_activation_email($msg, $u_id, $activation_url) {
// $username = $_POST['signup_username'];
$userinfo = get_userdata($u_id);
$username = $userinfo->user_login;
$msg .= sprintf( __("After successful activation, you can log in using your username (%1\$s) along with password you choose during registration process.", 'textdomain'), $username);
return $msg;
}