Inspiration For Creative Minds
Home » Labs » Send Email Notification in WordPress when User Updates Profile  

Filed under Labs

WordPress have default functions send emails to users, besides using that we can also write custom functions. Here is a WordPress snippet which will send email notification to user when they updated their profile. To enable email notification for profile updates you need to copy and paste the following code to your functions.php. Once added the code your WP site can send emails to users for their profile updates.

<?php 
function user_profile_update( $user_id ) {
        $site_url = get_bloginfo('wpurl');
        $user_info = get_userdata( $user_id );
        $to = $user_info->user_email;
        $subject = "Profile Updated: ".$site_url."";
        $message = "Hi " .$user_info->display_name . "\nYour profile has been successfully updated!";
        wp_mail( $to, $subject, $message);
}
add_action( 'profile_update', 'user_profile_update', 10, 2);
?>
It's only fair to share...Share on Google+Tweet about this on TwitterShare on Facebook
Labs

Posts you may like: