Send Admin Notification when User Updates specific Profile Field
-
I would like to create a simple email send to admin when a user updated a specific Profile Field.
The field is a checkbox so it should be an array because a have multiple values.The code that i alreade try to use is
function buddypress_profile_update( $user_id ) { $admin_email = "YOUR-EMAIL@DOMAIN.COM"; $message = sprintf( __( 'Member: %1$s', 'buddypress' ), bp_core_get_user_displayname( $user_id ) ) . "\r\n\r\n"; $message .= sprintf( __( 'Color: %s' ), bp_get_profile_field_data('field=Color') ). "\r\n\r\n"; wp_mail( $admin_email, sprintf( __( '[YOUR SITE] Member Profile Update' ), get_option('blogname') ), $message ); } add_action( 'xprofile_updated_profile', 'buddypress_profile_update', 10, 5 );
1st Problem. In the email i get just “Color: Array” , i have tried to use vsprintf instead but it gives me back only one value.
2d Problem. I get an email whenever there is an update in general, and not only when there is an update from the specific field with ID 7.
Any help would be appreciated.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.