Are you looking for a way to send email notification to WordPress users when their profile updates? While there’s probably a plugin for this, we have created a quick code snippet that you can use to send email notification when profile updates in WordPress.
Instructions:
All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:
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);
Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly copy / paste code snippets in WordPress, so you don’t accidentally break your site.
If you liked this code snippet, please consider checking out our other articles on the site like: 10 best WordPress testimonial plugins to add social proof and 18 Jetpack alternatives to get the features without bloat.
Can you set it up so it ONLY emails when and admin changes the user profile? In fluent SMTP it is showing that its sending double emails. One when they create the account (I am assuming) and one when I change something on their profile (i am just allocating items to their account by assigning them a specific brand)
Hello,
Is there a way to have the email highlight what part of their profile was updated?
Thank you!
Sadly we don’t currently have a snippet for this.
You may want to check out the profile_update hook: https://developer.wordpress.org/reference/hooks/profile_update/
You may be able to add arguments for the $old_user_data and $userdata objects to the user_profile_update function and compare the two objects.
Hi there!
I operate a directory based website where members register using ultimate member and then I create listings on a map with a seperate plugin.
Problem is is when a user updates their profile, I have no way of knowing and I’m not able to manually update the map listing when their profile has been changed.
Is there a way that I, as administrator, can receive an email every time EVERY user makes a change to their profile?
Thank you!
You could use this snippet and change the
$to
variable to your email address.BRAVO MERCI ! Mais ça m’envoie deux fois le mail…
function user_profile_update( $user_id ) {
$site_url = get_bloginfo(‘wpurl’);
$user_info = get_userdata( $user_id );
$to =”[email protected]”;
$subject = “Mise a jour profil: ” .$user_info->display_name . “”;
$message = “Le profil: ” .$user_info->display_name . ” a ete mis a jour \n\nRentre tout ca dans ACCESS au lieu de me regarder betement\n “;
wp_mail( $to, $subject, $message);
}
add_action( ‘profile_update’, ‘user_profile_update’, 10, 2);
J’ai pas trouvé de solution … Encore Merci !
You may want to check that the “profile_update” hook is not being run twice.
Can we send email when specific field is updated ?
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
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.
I think if is showing as spam you can just mark as not a spam.correct me of i didn’t get properly your question