Skip to:
Content
Pages
Categories
Search
Top
Bottom

Add total group topics as total group members

  • Hi,

    When you are in a group, you can see tabs “Activity”, “Forum” and “Members (x)” below the group description.
    I want to add number total of topics. i.e. “Forum (x)” but I have no idea how to add this..

    Someone could help me ?

    Thanks.
    Guillaume.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Nobody ?

    Help me pleeeeeeeease ! Thanks :)

    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.

    Ok. Thanks ! I’ll test that.

    @nuprn1

    In bp-groups.php, I’ve replaced :

    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’ ) );

    by

    bp_core_new_subnav_item( array( ‘name’ => sprintf( __( ‘Forum (%s)’, ‘buddypress’ ), groups_get_groupmeta( $bp->groups->current_group->id, ‘forum_id’ ) ), ‘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’ ) );

    But the fonction called catch the current group forum id instead of the current group forum topic count.

    Is it why you told me that : “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.” ? Because I don’t understand what you mean..

    Thanks.

    Sorry, I was only posting the idea of what you can do, I don’t particularly have the time to code a solution. Though I do not recommend hacking the core files as there is a function to remove the subnav.

    Ok. Thanks for the idea, I’ll try differently.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Add total group topics as total group members’ is closed to new replies.
Skip to toolbar