PriMoThemes — now s2Member® (official notice)
This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™
man-O-media wrote:So I searched the forum for notification AND profile but got nothing really useful so...
Is it possible to have S2Member or S2Member Pro send an email notification whenever a member updates their profile information?
And in more detail... Is it possible to have S2Member or S2Member Pro send an email notification whenever a member updates certain fields of their profile information, for example if they change their contact phone number or email address?
Thanks, DP
<?php
add_action ("ws_plugin__s2member_during_handle_profile_modifications", "my_function");
function my_function ($vars = array ())
{
$user = new WP_User ($vars["user_id"]);
wp_mail ("admin@example.com", "Subject ( " . $user->user_login . " just updated their Profile )", "Message Body goes here.");
}
?>
function my_function(){
$user = wp_get_current_user();
print_r($user); to get a full list of $user data during testing.
<?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"]);
// print_r($user);
wp_mail ('me@mydomain.net', 'Subject ( ' . $user->user_login . ' just updated their Profile )', 'Message Body goes here.' . $user['my_phone']);
}
?>
try $user->my_phone
<?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"]);
// print_r($user);
// print_r($user->home_phone);
wp_mail ('me@mydomain.com', 'Subject ( ' . $user->user_login . ' just updated their Profile )', 'Message Body goes here.' );
}
?>
<?php
add_action("ws_plugin__s2member_during_handle_profile_modifications", "email_profile_changes");
function email_profile_changes(){
global $current_user;
get_currentuserinfo();
wp_mail("me@mydomain.com", $current_user->user_login . " has updated their membership profile", " User Login: " . $current_user->user_login . "\n" . " User ID: " . $current_user->ID . "\n" . ' First Name: ' . $current_user->user_firstname . "\n" . ' Last Name: ' . $current_user->user_lastname . "\n" . ' User email: ' . $current_user->user_email );
}
?>
<?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->street_address_1 . '
' . $user->street_address_2 . '
City: ' . $user->city . '
And so on...');
}
?>
<?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...');
}
?>
so, I'm still learning about classes and objects, so I'm not sure if the formatting when accessing an array inside an object will be 100% correct, but we'll know after you try.
Wants User Listing: ' . ($user->mysite_wp_s2member_custom_fields['wants_user_listing'] == 1 ? 'Yes' : 'No') . '
Cristián Lávaque wrote:I'm glad it worked!
About the checkboxes, 1 means it was checked, empty means that it wasn't. You need to work with that when creating the email.
- Code: Select all
Wants User Listing: ' . ($user->mysite_wp_s2member_custom_fields['wants_user_listing'] == 1 ? 'Yes' : 'No') . '
Cristián Lávaque wrote:
- Code: Select all
<?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, '
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...');
}
?>
Users browsing this forum: No registered users and 0 guests