strangerstudios / pmpro-buddypress

Manage access to your BuddyPress Community using Paid Memberships Pro
https://www.paidmembershipspro.com/add-ons/buddypress-integration/
17 stars 22 forks source link

Restricted BuddyPress Groups show as "Public Groups" in templates #78

Closed kimcoleman closed 2 years ago

kimcoleman commented 3 years ago

When groups list or single page viewing is allowed for private groups, they show as "Public Group" because we instruct sites to leave the BuddyPress Group's Privacy Settings as "public".

An option would be something like the code below where we could filter the term "Public Group" based on whether groups joining is public. This is not complete code as is - it is currently just completely hiding the "Private Group" or "Public Group" label.

function bp_nouveau_get_group_meta_custom( $group_meta, $group, $is_group ) {
    if ( isset( $group_meta['status'] ) ) {

        $group_meta['status'] = '';
    }
    return $group_meta;
}
add_filter( 'bp_nouveau_get_group_meta', 'bp_nouveau_get_group_meta_custom', 10, 3 );

function bp_get_group_type_custom( $group ) {
    return '';
}
add_filter( 'bp_get_group_type', 'bp_get_group_type_custom' );
kimcoleman commented 3 years ago

This is tested and confirmed working in both BuddyPress Legacy and Nouveau as well as BuddyBoss Platform.