Thanks for the heads up on this thread.The seemingly mysterious email I think you're referring to, is a basic transactional email that s2Member sends out whenever an "existing" User/Member is being upgraded or downgraded, as opposed to signing up for a "new" account. I refer to this as a "modification" transactional email, and at this time ( i.e. s2Member v110815 ), it can only be customized with Hooks/Filters.
Create this directory and file:
/wp-content/mu-plugins/s2-hacks.php
- Code: Select all
<?php
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.";
}
add_filter ("ws_plugin__s2member_modification_email_msg", "my_s2_modification_msg", 10, 2);
function my_s2_modification_msg ($s2member_default_msg, $vars = array ())
{
return "Thank you! You've been updated to:\n" . $vars["paypal"]["item_name"] . "\n\nPlease log back in now:\n" . wp_login_url ();
}
?>
If you need to perform conditionals before spitting out the contents of these emails, you may find it helpful to examine all of the information passed through to your Filter function inside the $vars array. There is MUCH information stored inside that array, including: $vars["user"], $vars["user_id"] and $vars["paypal"] ( which is an array of PayPal details related to the modification ).
Here are some other Filters that you may find useful in cases where you need more control over the content of emails ( i.e. when you need to use conditionals, or insert other information dynamically ). For instance, these two Filters allow for greater control over the Signup Confirmation Email:
- Code: Select all
ws_plugin__s2member_signup_email_sbj
ws_plugin__s2member_signup_email_msg
These control the Confirmation email for Specific Post/Page Access:
- Code: Select all
ws_plugin__s2member_sp_email_sbj
ws_plugin__s2member_sp_email_msg
In all cases, you can use the code sample I provided above, and just change the Filter names and the way you fill the content of the data being filtered. For example, this is how you might dynamically modify the content of the Signup Confirmation Email via PHP scripting.
Create this file and directory:
/wp-content/mu-plugins/s2-hacks.php
- Code: Select all
<?php
add_filter ("ws_plugin__s2member_signup_email_sbj", "my_s2_signup_sbj", 10, 2);
function my_s2_signup_sbj ($s2member_default_sbj, $vars = array ())
{
return "Congratulations ( your account has been approved )";
}
add_filter ("ws_plugin__s2member_signup_email_msg", "my_s2_signup_msg", 10, 2);
function my_s2_signup_msg ($s2member_default_msg, $vars = array ())
{
return "Thank you! You purchased:\n" . $vars["paypal"]["item_name"] . "\n\nPlease register now:\n" . add_query_arg("action", "register", wp_login_url ());
}
?>
( Please note that $vars["user"], $vars["user_id"] are NOT available for the Signup Confirmation Email like they are for modifications, because the Customer has not yet registered. That's what the Signup Confirmation email is actually for
( i.e. to help them get registered ).