Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Add total group topics as total group members


rich! @ etiviti
Participant

@nuprn1

the subnav is not setup for a string replacement on the “Forums” tab for a dynamic count

bp_core_new_subnav_item( array( ‘name’ => __( ‘Forum’, ‘buddypress’ ), ‘slug’ => ‘forum’, ‘parent_url’ => $group_link, ‘parent_slug’ => $bp->groups->slug, ‘screen_function’ => ‘groups_screen_group_forum’, ‘position’ => 40, ‘user_has_access’ => $bp->groups->current_group->user_has_access, ‘item_css_id’ => ‘forums’ ) );

vs

bp_core_new_subnav_item( array( ‘name’ => sprintf( __( ‘Members (%s)’, ‘buddypress’ ), number_format( $bp->groups->current_group->total_member_count ) ), ‘slug’ => ‘members’, ‘parent_url’ => $group_link, ‘parent_slug’ => $bp->groups->slug, ‘screen_function’ => ‘groups_screen_group_members’, ‘position’ => 60, ‘user_has_access’ => $bp->groups->current_group->user_has_access, ‘item_css_id’ => ‘members’ ) );

You could remove and re-add the Forums subnav and include the sprintf call and reference this function

bp_forums_get_forum_topicpost_count( $forum_id ) will grab the count for all posts (including topics) for a given forum_id (but in buddypress the bbpress forum_id is stored in groups_get_groupmeta( $bp->groups->current_group->id, ‘forum_id’ ) )

you may also want to look at BP_Groups_Group::get_global_forum_topic_count but that is an overall general count – this function could be duplicated and changed to a per forum_id basis.

Skip to toolbar