This code sample you posted previously is very close. However, one of your functions has the wrong name here.
function my_s2_signup_msg
should be: my_s2_registeration_msg
Or maybe: my_s2_registration_msg
Very close. Looks pretty good overall. If you want to inspect the $vars
array, you can check the debug.log file for all of the array keys this variable contains. In the functions below, you are logging this data already.
add_filter ("ws_plugin__s2member_registration_notification_email_sbj", "my_s2_registeration_sbj", 10, 2);
function my_s2_registeration_sbj ($s2member_default_sbj, $vars = array ())
{
print_r($vars);
file_put_contents(WP_CONTENT_DIR."/debug.log", var_export($vars, true));
return "testing registeration email subject";
}
add_filter ("ws_plugin__s2member_registration_notification_email_msg", "my_s2_registeration_msg", 10, 2);
function my_s2_signup_msg ($s2member_default_msg, $vars = array ())
{
print_r($vars);
file_put_contents(WP_CONTENT_DIR."/debug.log", var_export($vars, true));
return "Thank you! You purchased:\n" . $vars . "\n\nPlease register now:\n" . add_query_arg("action", "register", wp_login_url ());
}
In this code sample you posted, you are sending email (which you won’t want to do on a live site).
You probably know this already, but just to point this out. These are filters, not actions. You simply return the custom email subject and message body.
add_filter (“ws_plugin__s2member_registration_notification_email_sbj”, “my_s2_registeration_sbj”, 10, 2);
function my_s2_registeration_sbj ($s2member_default_sbj, $vars = array ())
{
wp_mail(‘testemail’, ‘subject triggered’, ‘subject triggered’, $headers);
return “testing registeration email subject”;
}
add_filter (“ws_plugin__s2member_registration_notification_email_msg”, “my_s2_registeration_msg”, 10, 2);
function my_s2_registeration_msg ($s2member_default_msg, $vars = array ())
{
wp_mail(‘testemail’, ‘body text triggered’, ‘body text triggered’, $headers);
return “testing registeration email body text”;
}
If these Filters are not working during test transactions, please be sure that you are actually registering for a new account, and not modifying an existing one. There are two additional filters against a short modification email that s2Member sends as well. You can look these up in the s2Member source code if you like.
ws_plugin__s2member_modification_notification_email_sbj
ws_plugin__s2member_modification_notification_email_msg