Thanks for answering, but there are no tokens for custom xprofile fields?
It will be custom work. You can add this code snippet in your child theme’s functions.php to achieve this:
add_filter('bp_core_signup_send_validation_email_message','ps_user_data_to_email',10,2);
function ps_user_data_to_email( $msg, $user_id )
{
$user = get_user_by( 'id', $user_id );
if(!empty($user))
$data1 = xprofile_get_field_data('your_first_field_name',$user->ID);
echo 'Your Profile Field Name'. ' : '.$data1;
$data2 = xprofile_get_field_data('your_second_field_name',$user->ID);
echo 'Your Profile Field Name'. ' : '.$data2;
}
You can do this for all the profile fields by just repeating the code to get data3 data4 like I did for data1 data2 and obviously you have to use your profile fields name in place of ‘your_first_field_name’, ‘your_second_field_name’ and ‘Your Profile Field Name’.
Thanks
Thank you for helping me, Prashant Singh.
I tried this on my on my staging site,
add_filter('bp_core_signup_send_validation_email_message','ps_user_data_to_email',10,2);
function ps_user_data_to_email( $msg, $user_id )
{
$user = get_user_by( 'id', $user_id );
if(!empty($user))
$data1 = xprofile_get_field_data('Navn',$user->ID);
echo 'Navn'. ' : '.$data1;
$data2 = xprofile_get_field_data('Postnr._og_by',$user->ID);
echo 'Adresse 2'. ' : '.$data2;
}
but the ‘new user email’ stays the same – username and email included and nothing else.
Is the syntax wrong? I just replaced spaces with ‘_’ in field names. Is ‘.’ allowed? (data2)
Cheers
No, please write the field name exactly it is there in xprofile field. You can also use field id instead the name.