I tried xprofile_get_field_data() but it didn’t work, maybe I’m just too dumb..
So I tried it using MySQL, here is my function wp_new_user_notification, I edit wp-includes/pluggable.php
function wp_new_user_notification($user_id, $plaintext_pass = ”) {
$user = new WP_User($user_id);
$user_login = stripslashes($user->user_login);
$user_email = stripslashes($user->user_email);
$buddypress_fields = $user_id;
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
// we want to reverse this for the plain text arena of emails.
$blogname = wp_specialchars_decode(get_option(‘blogname’), ENT_QUOTES);
$message = sprintf(__(‘New user registration on your site %s:’), $blogname) . “rnrn”;
$message .= sprintf(__(‘Username: %s’), $user_login) . “rnrn”;
$message .= sprintf(__(‘E-mail: %s’), $user_email) . “rnrn”;
// Add Custom Fields from buddypress table to admin email – Start
$buddypress_result_ = mysql_query(“SELECT
wp_bp_xprofile_fields.name,
wp_bp_xprofile_data.value
FROM wp_bp_xprofile_fields, wp_bp_xprofile_data
WHERE
wp_bp_xprofile_data.user_id = $user_id
AND
wp_bp_xprofile_fields.id = wp_bp_xprofile_data.field_id
ORDER BY
wp_bp_xprofile_data.field_id”);
while($buddypress_row = mysql_fetch_array($buddypress_result_))
{
$fields = $buddypress_row;
$fields_value = $buddypress_row;
$message .= $fields . “: rn”;
$message .= $fields_value . “rnrn”;
}
// Add Custom Fields from buddypress table to admin email – End
@wp_mail(get_option(‘admin_email’), sprintf(__(‘[%s] New User Registration’), $blogname), $message);
if ( empty($plaintext_pass) )
return;
$message = sprintf(__(‘Username: %s’), $user_login) . “rn”;
$message .= sprintf(__(‘Password: %s’), $plaintext_pass) . “rn”;
$message .= wp_login_url() . “rn”;
wp_mail($user_email, sprintf(__(‘[%s] Your username and password’), $blogname), $message);
}