Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/08/2016 09:38:46 PM (9 years ago)
Author:
boonebgorges
Message:

Use unformatted group count when deciding whether to use the 'no-count' in user nav.

A number of problems can arise when using a formatted group count for this
comparison, because formatted counts are strings.

Fixes #6813.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/bp-groups-loader.php

    r10417 r10445  
    435435        // Only grab count if we're on a user page.
    436436        if ( bp_is_user() ) {
    437             $count    = bp_get_total_group_count_for_user();
    438             $class    = ( 0 === $count ) ? 'no-count' : 'count';
    439             $nav_name = sprintf( _x( 'Groups <span class="%s">%s</span>', 'Group screen nav with counter', 'buddypress' ), esc_attr( $class ), bp_core_number_format( $count ) );
     437            $class    = ( 0 === groups_total_groups_for_user( bp_displayed_user_id() ) ) ? 'no-count' : 'count';
     438            $nav_name = sprintf( _x( 'Groups <span class="%s">%s</span>', 'Group screen nav with counter', 'buddypress' ), esc_attr( $class ), bp_get_total_group_count_for_user() );
    440439        } else {
    441440            $nav_name = _x( 'Groups', 'Group screen nav without counter', 'buddypress' );
Note: See TracChangeset for help on using the changeset viewer.