Tips and Tricks HQ Support Portal › Forums › WP eMember › WP eMember Tweaks › Email Notifications when Member Profile is Updated
- This topic has 3 replies, 3 voices, and was last updated 2 years, 11 months ago by admin.
-
AuthorPosts
-
February 1, 2022 at 7:57 am #84127mpnincSpectator
We need an email notification sent to our admins whenever a member updates their profile. We use the form builder and profile extended add-ons. I tried adding the following code to my functions.php (using both eMember_profile_updated and eMember_profile_updated_form_builder) but I cannot get it to work. Nothing seems to happen at all and I don’t see anything in the logs. Am I missing something or is there a different hook that I need to be using? Maybe I just messed up the code or am approaching it the wrong way. Any help or insights would be hugely appreciated. Thank you.
add_action(‘eMember_profile_updated’, ‘run_my_custom_function’, 10, 2);
function run_my_custom_function($fields, $custom_fields){
$member_id = $fields[‘member_id’];
$username = $fields[‘username’];
$to = “email@mysite.com”;
$subject = “Member Profile Updated”;
$header = “From: ” . “accounts@mysite.com” . “rn”;
$message = “Member profile updated. Please review user details for ” . $username;
mail($to,$subject,$message,$header);
}WordPress 5.8.3 | WP eMember 10.3.5 | eMember Form Builder 2.9 | eMember Profile Extended 2.4
February 1, 2022 at 3:05 pm #84129wzpModeratorI tried adding the following code to my functions.php
Is the add_action() function in a part of your theme’s functions.php file, that is actually being parsed, when the form is displayed?
is there a different hook that I need to be using?
You seem to be doing it right, according to this previous thread:
eMember – Is it possible to have email to admin after customer update profile?
- This reply was modified 2 years, 11 months ago by wzp.
February 4, 2022 at 2:45 pm #84135mpnincSpectatorThank you for your reply but I am not sure what you mean by “Is the add_action() function in a part of your theme’s functions.php file, that is actually being parsed, when the form is displayed?” How do I even know? Is there a certain place in functions.php that the add_action() function needs to be?
February 5, 2022 at 12:09 am #84138adminKeymasterI can see that you are using the form builder addon. Try the following hook which is triggered by that addon:
add_action('eMember_profile_updated_form_builder', 'run_my_custom_function', 10, 2);
Give that a try.
Side Note: Code customization should really be done by a developer. Please note that code customization related queries are beyond the scope of our standard support. You can use the following option if you want us to create a small custom solution for you:
-
AuthorPosts
- You must be logged in to reply to this topic.