You want something like
if ( class_exists( '\WPDiscourse\Discourse\Discourse' ) ) {
add_filter( 'wpdc_sso_params', 'wpdc_custom_sso_params', 10, 2 );
}
function wpdc_custom_sso_params( $params, $user ) {
$groups = get_group_list_for_current_user();
if ( strlen($groups) > 0 ) {
$params['add_groups'] = $groups;
}
return $params;
}
will work. get_group_list_for_current_user
is left as an exercise to the reader.
If that doesn’t help and you have a budget, you can ask in marketplace or contact me.