I’m using S2Member Pro Version 160801 + s2Member Pro v160801 with Buddypress Version 2.7.2.
I want to automatically add the free and paid S2M signups with CCAPS to the appropriate BP groups.
So, I have a BP Group called Au Pair Group
with a permalink of au-pair-group
and a Proforms shortcode like this:
[s2Member-Pro-PayPal-Form register="1" level="0" ccaps="aupair_free" custom="***.com" tp="0" tt="D" /]
I have followed the guide here:
My code is currently:
<?php add_action('ws_plugin__s2member_during_configure_user_registration', function (array $vars) { extract($vars); // Variables from registration context. // Run
print_r($vars);to get a full list for inspection. // The most important variable extracted here is
$user` (a WP User object).
# Configuration. Array keys are s2Member CCAP names.
# A BuddyPress Group slug can be acquired by inspecting its Permalink in WordPress.
$s2member_bp_groups_map = array(
'aupair_free' => array('au-pair-group'),
);
# Do NOT edit anything below this line.
if (bp_is_active('groups')) {
foreach ($s2member_bp_groups_map as $_ccap => $_group_slug) {
if (($_group_id = BP_Groups_Group::group_exists($_group_slug))) {
if($user->has_cap('access_s2member_ccap_'.$_ccap)) {
groups_join_group($_group_id, $user->ID);
}
}
}
}
});`
If I run print_r($vars);
- the variables to get dumped, so my file & folder names are correct, but the new members just don’t appear in the BP Group automatically.
Does this code example still apply to the current versions?
Any suggestions what I can do to get this to work?
thank you