Using XProfile fields in Admin Notification Mail after activation
-
Hi,
I’m new to buddypress and I was trying to add the xprofile fields to admin email after activation.
I found this code and I’m desperately trying to figure out how to make it work.
/* Plugin Name: Custom New User Email Description: Changes the copy in the email sent out to new users */ // Redefine user notification function if ( !function_exists('wp_new_user_notification') ) { function wp_new_user_notification( $user_id, $plaintext_pass = '' ) { $user = get_userdata( $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); // find the profile field for referrer //$field1 = xprofile_get_field_data( 'Referrer', $user_id ); $field1 = xprofile_get_field_data( 'field_id=1', $user_id ); $field2 = xprofile_get_field_data( 'field_id=2', $user_id ); $field3 = xprofile_get_field_data( 'field_id=3', $user_id ); $field4 = xprofile_get_field_data( 'field_id=4', $user_id ); $field5 = xprofile_get_field_data( 'field_id=5', $user_id ); $field6 = xprofile_get_field_data( 'field_id=6', $user_id ); $field7 = xprofile_get_field_data( 'field_id=32', $user_id ); $field8 = xprofile_get_field_data( 'field_id=8', $user_id ); $field9 = xprofile_get_field_data( 'field_id=9', $user_id ); $field10 = xprofile_get_field_data( 'field_id=10', $user_id ); $field11 = xprofile_get_field_data( 'field_id=13', $user_id ); $field12 = xprofile_get_field_data( 'field_id=16', $user_id ); $field13 = xprofile_get_field_data( 'field_id=25', $user_id ); $message = sprintf(__('New user registration on your site %s:'), $blogname) . "\r\n\r\n"; $message .= sprintf(__('Username: %s'), $user->user_login) . "\r\n\r\n"; $message .= sprintf(__('E-mail: %s'), $user->user_email) . "\r\n\r\n"; $message .= sprintf(__('First Name: %s'), $field1) . "\r\n"; $message .= sprintf(__('Last Name: %s'), $field2) . "\r\n"; $message .= sprintf(__('Job Title: %s'), $field3) . "\r\n"; $message .= sprintf(__('Company: %s'), $field4) . "\r\n"; $message .= sprintf(__('Address 1 : %s'), $field5) . "\r\n"; $message .= sprintf(__('Address 2 : %s'), $field6) . "\r\n"; $message .= sprintf(__('Country : %s'), $field7) . "\r\n"; $message .= sprintf(__('City: %s'), $field8) . "\r\n"; $message .= sprintf(__('Zip: %s'), $field9) . "\r\n"; $message .= sprintf(__('Phone: %s'), $field10) . "\r\n"; $message .= sprintf(__('Fax: %s'), $field11) . "\r\n"; $message .= sprintf(__('Relationship: %s'), $field12) . "\r\n"; $message .= sprintf(__('Interest: %s'), $field13) . "\r\n"; @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message); if ( empty($plaintext_pass) ) return; $message = sprintf(__('Username: %s'), $user->user_login) . "\r\n"; $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n"; $message .= wp_login_url() . "\r\n"; wp_mail($user->user_email, sprintf(__('[%s] Your username and password'), $blogname), $message); } }
Please help.
Thank you so much
Dennis
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- You must be logged in to reply to this topic.