@simon
Simon, if i understood you correctly, this is what it should now look like.
(i’d have used colours - except i don’t know how…)
but… I may not have completely understood what to do with the final parameters.
i first included them ‘once, at the end’, then, when that didn’t work, i included them ‘after every statement’.
the plug-in accepts the code as valid, but users do not get removed from the old group, so in functionality this one remains the same as what i started with.
add_filter( 'wpdc_sso_params', 'wpdc_custom_sso_params' );
function wpdc_custom_sso_params( $params ) {
if ( current_user_can( 'mepr-active','memberships:48259,48238' ) ) {
$params['add_groups'] = 'TransformPlus';
} else {
$remove_groups[] = 'TransformPlus';
} {
$params['remove_groups'] = join( 'ForeverFree','CreativeLicense','JoinLive','Transform','TransformPlus', $remove_groups );
}
if ( current_user_can( 'mepr-active','memberships:47303,47305' ) ) {
$params['add_groups'] = 'Transform';
} else {
$remove_groups[] = 'Transform';
} {
$params['remove_groups'] = join( 'ForeverFree','CreativeLicense','JoinLive','Transform','TransformPlus', $remove_groups );
}
if ( current_user_can( 'mepr-active','memberships:47299,47301' ) ) {
$params['add_groups'] = 'JoinLive';
} else {
$remove_groups[] = 'JoinLive';
} {
$params['remove_groups'] = join( 'ForeverFree','CreativeLicense','JoinLive','Transform','TransformPlus', $remove_groups );
}
if ( current_user_can( 'mepr-active','memberships:47295,47297' ) ) {
$params['add_groups'] = 'CreativeLicense';
} else {
$remove_groups[] = 'CreativeLicense';
} {
$params['remove_groups'] = join( 'ForeverFree','CreativeLicense','JoinLive','Transform','TransformPlus', $remove_groups );
}
if ( current_user_can( 'mepr-active','memberships:47281' ) ) {
$params['add_groups'] = 'ForeverFree';
} else {
$remove_groups[] = 'ForeverFree';
} {
$params['remove_groups'] = join( 'ForeverFree','CreativeLicense','JoinLive','Transform','TransformPlus', $remove_groups );
}
return $params;
}
i understand that you can’t go too deeply into this matter, but you’re my last resort.
i’ve asked everywhere else, including memberpress and the developers they recommend.
i don’t speak php, at all. everything i’ve done so far is extrapolate from the snippets of code i’ve found left and right - particularly the pieces you’ve shared with me.
as it is right now, i’m ‘happy’, because people get put into the correct groups. but they don’t get taken out of the old one, and so that’s more steps for me to keep track of – so if there’s any way you might provide the missing code, that would just be… awesome…
thanks!
p.s., inverting the order did not help.