Skip to:
Content
Pages
Categories
Search
Top
Bottom

Notify Admin when certain profile field is updated by member


  • amkh
    Participant

    @amkh

    Hi,

    I used the code below to notify by email when member updates certain field. In my case the field is multiline text box (TinyMCE). I replaced the email and field ID in the code with my actuals.

    But this snippet is not sending me emails.

    function rc_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', 'rc_buddypress_profile_update', 10, 5 );
    
  • You must be logged in to reply to this topic.
Skip to toolbar