Skip to:
Content
Pages
Categories
Search
Top
Bottom

Remove member count from certain groups


  • davewp85
    Participant

    @davewp85

    Hello all,

    I have four groups that all users join upon registration, which they cannot leave. But this means that from the member count of these groups, everyone can see the total number of members of the community. This is not good.
    How can I remove the member count of these groups from everywhere it appears?

    – In the Groups directory, and in profiles in the Groups tab, the line ‘Public Group / 100 members’.
    – In each group’s page in the Members tab.
    – In each group’s page when clicking the Members tab, the line ‘Viewing 1 – 100 of 100 members’.

    This is the code (by Boone Gorges) I used to hide the Leave button of these groups. I’m posting it in case it helps.

    function bbg_remove_leave_group_button( $button ) {
    	$cant_leave_these_groups = array( 1, 2, 3, 4 );
    
    if ( 'leave_group' == $button['id'] ) {
    		// Hack to get the group id in any context
    		$group_id = (int) array_pop( explode( '-', $button['wrapper_id'] ) );
    
    if ( in_array( $group_id, $cant_leave_these_groups ) ) {
    			return false;
    		}
    	}
    
    return $button;
    }
    add_filter( 'bp_get_group_join_button', 'bbg_remove_leave_group_button' );

    Could a similar code be used to remove the member count of the same groups?

    Thanks,
    Dave

  • You must be logged in to reply to this topic.
Skip to toolbar