@simon, a few years back you helped us add code to auto-add groups to users based on their membership in WordPress/MemberPress. That works great. We are now hoping to auto add/remove groups based on user meta data. I have the below, which feels like it should work with the other code we have:
$nbes_session = get_user_meta( $current_user->ID, 'mepr_national_board_certifying_exam_session' , true );
if (! empty( $nbes_session )) {
$groups_to_add[] = 'nbes_' + $nbes_session;
} else {
$groups_to_remove[] = 'nbes_' + $nbes_session;
}
It doesn’t seem to be adding that group to the user though. Is there something I am missing? Thanks in advance for your help.