简体   繁体   中英

Hide Member count in Buddypress groups

I am new to BuddyPress and want to hide the member count in the groups. As mentioned in another forum, I tried using this code in bp-custom.php but it doesn't work.

function john_gettext( $translated, $original_text, $domain ) {

    if ( 'buddypress' !== $domain )  
           return $translated;

    switch ( $original_text ) {
        case 'All Members <span>%s</span>':
            return 'All Members';

        default:
            return $translated;
    }
}
add_filter( 'gettext', 'john_gettext', 20, 3 );

Also tried adding this code and doesn't work:

add_filter( ‘bp_get_total_member_count’, ‘bp_core_number_format’ );

Any ways to hide the member count?

gettext is not used in that context. And changing the count integer will result in a zero being shown. But you can filter the existence of a count and thereby remove it. Try:

function john_member_count( $count, $item, $nav ) {

    if ( $nav == 'directory' )
        $count = false;

    return $count;
}
add_filter( 'bp_nouveau_nav_has_count', 'john_member_count',30, 3 );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM