See http://hookr.io/plugins/buddypress/#index=g&search=bp_get_member_types
1 – get the member types
2 – if $mt == the_allowed_type
3 – show the button
Thank you very much for the guidance!
can you help with the code to show/hide the button?
I think i’m on the right track, but not sure what to return on else condition:
function bp_remove_group_join_button() {
$member_type = xprofile_get_field_data( 'Member Type', bp_get_member_user_id());
if ( $member_type == 'Option 1' ) {
return '';
}
else {
return ????;
}
}
add_filter( 'bp_get_group_join_button', 'bp_remove_group_join_button');
But, i’m open to other approaches that work 🙂
You don’t absolutely need an else statement.
All filters need to return something.
Try:
function bp_remove_group_join_button( $button, $group ) {
$member_type = xprofile_get_field_data( 'Member Type', bp_get_member_user_id());
if ( $member_type == 'Option 1' )
return '';
return $button;
}
add_filter( 'bp_get_group_join_button', 'bp_remove_group_join_button', 10, 2);
Thanks for you help! Got it!