Hello,
I allow myself to come here because I can not find an answer to my problem even after scouring the internet.
I’m on S2member Pro
And I would like to create a hook to send mail notifications when a user makes a change on his profile.
I found this solution which is old, I do not know if it is still current with the recent update of S2member.
Reference link of the hook on which I base myself : http://www.primothemes.com/forums/viewtopic.php?f=4&t=2193
I manage to put the hook, it works. Only I can not display the customized fields in the mail:
I use this code:
<?php
add_action ('ws_plugin__s2member_during_handle_profile_modifications', 'email_profile_changes');
function email_profile_changes($vars = array())
{
$user = new WP_User($vars['user_id']);
wp_mail ('me@mydomain.com', 'Profile update - ' . $user->user_login, '
First Name: ' . $user->first_name . '
Last Name: ' . $user->last_name . '
Address: ' . $user->mysite_wp_s2member_custom_fields['street_address_1'] . '
' . $user->mysite_wp_s2member_custom_fields['street_address_2'] . '
City: ' . $user->mysite_wp_s2member_custom_fields['city'] . '
And so on...');
}
?>
Do you find some things that are wrong
I am only a novice in website …
Thanks in advance to the community