wordpress snippets last updated   : January 29, 2015
we now have 646 snippets

Send email notification when profile updates

wordpress snippet

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.

snippet :  PHPcopy
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);

Did you like this post? If so please share it with your friends. Thanks!

  • rohit

    its workin perfectly. but mail is showing to spam folder


    • http://wpsnipp.com Kevin Chard

      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