Home / admin / Send email notification when profile updates
  • How to Send email notification when profile updates


    I got a few emails asking about sending an email when a user simply updates the profile. Well here it is, adding this snippet to the functions.php of your wordpress theme will send an email notification to the user when the user profile updates.

    ( click code to copy )

    wordpress snippet : 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 = "Hello " .$user_info->display_name . "\nYour profile has been updated!\n\nThank you for visiting\n ".$site_url."";
            wp_mail( $to, $subject, $message);
    add_action( 'profile_update', 'user_profile_update', 10, 2);

    ( WordPress codex functions, hooks, in this snippet. )

    bloginfo, get_userdata, add_action, _n, _e, get_bloginfo, site_url, wp, wp_mail,
  • rohit

    its workin perfectly. but mail is showing to spam folder


    • Not much can be down about that, I would think it has to do with spam settings.

  • Dare

    Hello please i am new to wordpress,i want to set up multiple users which i have been able to do but also i want users to be notified via mail when new posts are added or updates are added.I read up your wordpress snippet on adding the codes u have above to function.php i cant find this function.php anywhere on my C drive.Please help out thanks