• Resolved selenasmith

    (@selenasmith)


    I have 2 issues:

    1. My client wants to receive an email when the user updates their profile. I’m using the following code but I’m not sure where to put it. I created a plugin but I get the error message “syntax error, unexpected ‘add_filter'(T_STRING) (34,1)”

    
    add_filter ( 'wppb_edit_profile_success', 'wppb_email_after_edit', 10, 3 );
    function wppb_email_after_edit($request, $form_name, $user_id){
       // for more information about wp_get_current_user please see http://codex.ww.wp.xz.cn/Function_Reference/wp_get_current_user
       // this is useful in case you want something more then just the user_login and ID
       if ( $form_name == 'edit_profile' ){
          $user_id = get_current_user_id();
       }
     
       $user = get_user_by('id', $user_id);
       $url = admin_url("/user-edit.php?user_id=$user_id");
     
       $to = get_option( 'admin_email' );
       $subject = "User: $user->user_login succesfully edited his account.";
       $message = "<p>User: $user->user_login succesfully edited or registered his account. View his account at <a href='$url'>his account</a></p>";
       $headers = "Content-type: text/html";
     
       wp_mail($to, $subject, $message, $headers);
    }

    2. The user wants to know what fields the user changed. How can I capture this information in the email?

    Thanks!
    Selena Smith

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Email when user changes profile’ is closed to new replies.