Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shanebp/587ba72216824f29b3e4f2eef747fa32 to your computer and use it in GitHub Desktop.
Save shanebp/587ba72216824f29b3e4f2eef747fa32 to your computer and use it in GitHub Desktop.
Try to add a count bubble next to a custom group tab added via BP_Group_Extension
// Using the Nouveau template pack
// Add a count bubble on a custom tab on a user profile is straightforward
$count = get_the_count_profile( $group_id );
$class = ( 0 === $count ) ? 'no-count' : 'count';
$name = sprintf( __( 'Events <span class="%s">%s</span>', 'bp-simple-events' ), esc_attr( $class ), number_format_i18n( $count ) );
bp_core_new_nav_item( array(
'name' => $name,
'slug' => 'events',
'position' => $tab_position,
'screen_function' => 'pp_events_profile',
'default_subnav_slug' => $default_subnav_slug,
'item_css_id' => 'member-events'
) );
// but afaik adding the count for a group tab added via BP_Group_Extension does not work in Nouveau ( it DOES work in Legacy pack )
$count = get_the_count_group();
$class = ( 0 === $count ) ? 'no-count' : 'count';
$name = sprintf( __( 'Events <span class="%s">%s</span>', 'bp-simple-events' ), esc_attr( $class ), number_format_i18n( $count ) );
$args = array(
'name' => $name,
'slug' => 'group-events',
'nav_item_position' => 200.5,
'show_tab' => $show_tab,
'screens' => $screens
);
parent::init( $args );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment