Cassel, I'll try to explain a little:
- Code: Select all
add_filter('ws_plugin__s2member_modification_email_sbj', 'my_s2_modification_sbj', 10, 2);
function my_s2_modification_sbj($s2member_default_sbj, $vars = array())
{
return 'Thank you! Your account has been updated.';
}
ws_plugin__s2member_modification_email_sbj is a hook in the code that lets you hook to the script at that point to do other things to customize it. So with
add_filter you're adding this customization using the function
my_s2_modification_sbj where
ws_plugin__s2member_modification_email_sbj is.
Now,
my_s2_modification_sbj receives a couple of vars that are given by s2Member to that hook, so that all the data can be available to you for the customization. These are
$s2member_default_sbj which is the default subject line, and
$vars, which is an array with all the vars in the script where the hook is. These aren't copies of the variables, but a shortcut to the actual variables, so if you change one of their values in the customization, it'll be changed after the hook in the script.
It's inside this array
$vars that you'll find the user's ID that Jason mentioned, as well as a lot of other info that you can use to customize the email. Here's an example using the user's ID in the customized subject line:
- Code: Select all
add_filter('ws_plugin__s2member_modification_email_sbj', 'my_s2_modification_sbj', 10, 2);
function my_s2_modification_sbj($s2member_default_sbj, $vars = array())
{
return 'Thank you user number ' . $vars['user_id'] . '! Your account has been updated.';
}
If you print_r, you'll get all the stuff in $vars so you see what's available to you. After you got the right array element names you need, remove the print_r.
http://php.net/print_r- Code: Select all
add_filter('ws_plugin__s2member_modification_email_sbj', 'my_s2_modification_sbj', 10, 2);
function my_s2_modification_sbj($s2member_default_sbj, $vars = array())
{
print_r($vars);
}
I hope this helps.