For the benefit of other readers, I'll re-post this in it's entirely,
Also, re-re-reading the instructions for that hack file, you mention S2_CUSTOM. How do i get more than one custom var? If i have product A and product B and product C and a customer can get any one of them or any combination of 2 (or 3) even if not at the same time, how are they identified?
<?php
add_filter("ws_plugin__s2member_mailchimp_merge_array", "my_filter");
function my_filter($merge, $vars)
{
// $merge /* Array of existing MERGE fields that s2Member passes by default. */
// $vars /* Array of defined variables in the scope/context of this Filter. */
$user_id = $vars["user_id"];
// print_r($vars); // Lots of good stuff in this array.
$user_custom = get_user_option("s2member_custom", $user_id);
$user_role = get_user_field ("s2member_access_role", $user_id);
$my_custom_merge_vars = array("S2_CUSTOM" => $user_custom, "S2_ROLE" => $user_role);
return array_merge($merge, $my_custom_merge_vars);
}
?>
Nope, you can put everything in one s2-hacks.php file. Or if you prefer, split things up into one file for each type of hack. The name "s2-hacks.php" is NOT required. Just make sure your file(s) have a PHP extension.
Another silly question: if i already created a hack file for another task, do i just add to the same file for this?
Right, this information is only processed during registration, and NOT during Profile updates. We're working on this however, for a future release.
Then, maybe something for down the road, but if the user is not automatically updated (like if it is an existing user) in WP, will this variable STILL be updated in MailChimp? Meaning does the information go to MailChimp right at registration/payment or only when it comes back to s2Member? (meaning that if s2M does not update it, MailChimp wont either)
Statistics: Posted by Jason Caldwell — October 17th, 2011, 5:12 pm
Statistics: Posted by cassel — October 16th, 2011, 5:47 pm
Statistics: Posted by cassel — October 7th, 2011, 8:06 pm
<?php
add_filter("ws_plugin__s2member_mailchimp_update_existing", "__return_true");
?>
Statistics: Posted by Jason Caldwell — October 7th, 2011, 2:37 pm
Statistics: Posted by Cristián Lávaque — September 30th, 2011, 5:40 pm
Statistics: Posted by cassel — September 28th, 2011, 7:05 pm