Reply To: %%item_name%% not populated
› Forums › General › %%item_name%% not populated › Reply To: %%item_name%% not populated
Thanks! Got the email.
I see. Yeah, some things are different in that array than was expected in your hack. I don’t know that if every transaction the hack was meant for, or only this one has the variables missing or in another place of the array.
Here’s is the hack a bit edited to use the available data:
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 " . $vars['user']['user_nicename'] . "\n\nYou have successfully purchased the " . $vars['paypal']['item_name'] . "\n\nIf you have not already done so, the next step is to Register a Username for the Campus.\n\n Please complete your registration here:" . wp_login_url() . "\n\nIf you have any trouble, please feel free to contact us.\n\nOnce your registation is completed, you can login and access your bonuses here: http://scrapbookcampus.com/" . $vars['paypal']['ccaps'];
}
Keep in mind that WP may changes the quotes (double and single) to curly ones, even when they are in a code block, so you may need to fix them for the code to work correctly.
First name wasn’t available in the array you sent me, so I changed it to the user’s nicename, but you’ll also need to test if it works for a new signup and not just an existing user.
The item name is the only one I think will be the same as you were expecting in the original hack.
The custom value 1 I couldn’t find in the array, and I wasn’t sure what you meant to have there for the bonuses link. I changed it to the ccap, in this case 12cards, although that URL doesn’t exist in your site. You’ll need to change that one to what it should be.
Let me know how the tests go. 🙂