@simon
Thanks, Simon, indeed, my text editor gives curly quotes,
unfortunately the code didn’t help. but… not giving up,
EDIT! It DID work, i had made an error in matching the names between Groups and WP users.
YEEHA!!! couldn’t be happier!!
BUT… they now get added to ALL groups.
so i will have to add the php one-by-one, each to their corresponding group.
like: 47281 leads to “Forever Free”
the next two lead to “Creative License” etc.
RE-EDIT:
I’ve inserted the code through my plugin in various ways. (i tried making a separate entrance for every group, but clearly you can only add one filter and the rest should follow within that one filter)
some of my attempts were directly bounced, so i discarded those.
the code below has been accepted, but it’s not working properly.
the first group works as it should. but then the next don’t, so i’m making a mistake in the code.
RE-EDIT: Turns out i had missed the curly quotes again…
Problem resolved, the below code works. (once you take out the curlies )
add_filter( 'wpdc_sso_params', 'wpdc_custom_sso_params' );
function wpdc_custom_sso_params( $params ) {
if ( current_user_can( 'mepr-active','memberships:47281' ) ) {
$params['add_groups'] = 'ForeverFree';
} else {
$params['remove_groups'] = 'ForeverFree';
}
if ( current_user_can( 'mepr-active','memberships:47295,47299' ) ) {
$params['add_groups'] = ‘CreativeLicense’;
} else {
$params['remove_groups'] = ‘CreativeLicense’;
}
if ( current_user_can( 'mepr-active','memberships:47303,47297' ) ) {
$params['add_groups'] = ‘JoinLive’;
} else {
$params['remove_groups'] = ‘JoinLive’;
}
if ( current_user_can( 'mepr-active','memberships:47301,47305' ) ) {
$params['add_groups'] = ‘Transform’;
} else {
$params['remove_groups'] = ‘Transform’;
}
if ( current_user_can( 'mepr-active','memberships:48259,48238' ) ) {
$params['add_groups'] = ‘TransformPlus’;
} else {
$params['remove_groups'] = ‘TransformPlus’;
}
return $params;
}
thanks for your help!
You have NO idea how happy i am. Just … awesome!
:- D.
POST-EDIT:
to anyone wanting to use this code for their own memberpress/discourse connection: it’s not complete yet!
when a member upgrades or downgrades, they get added to the new group, but they don’t get removed from the old group. still working on that.
Final Edit:
Solution can be found here: Memberpress: how to add users to groups upon Sign up