Skip to:
Content
Pages
Categories
Search
Top
Bottom

Subforum list not displaying if all subforums are private

  • @jczerwonka

    Member

    It seems bbp_get_forum_subforum_count() does not return private forums. So when all the subforums are private, this funcion returns 0 which causes the list forums function to bail.

    I got it around it by creating the following filter to count the forums:

    add_filter( 'bbp_get_forum_subforum_count', 'my_subforum_count', 3 );

    function my_subforum_count( $forum_count, $forum_id ) {
    $subforums = bbp_forum_get_subforums( array( 'post_parent' => $forum_id ) );
    return count( $subforums );
    }

    Please advise if you’d like me to create a trac ticket for this. I didn’t want to create a ticket in case it already exists or I’m just doing something wrong.

    Thanks,

    John

Viewing 2 replies - 1 through 2 (of 2 total)
  • @johnjamesjacoby

    Keymaster

    This was by design to avoid querying each forum for it’s children on each page load if it didn’t have any children.

    The ‘_bbp_forum_subforum_count’ post meta only contains a count of public forums, as returned by bbp_forum_query_subforum_ids() which uses bbp_get_public_child_ids().

    Now that forum status is baked into the query filter, this kind of check could probably use a rethink. Go ahead and open a ticket and I’ll look at it for 2.1.

    @andyt1980

    Participant

    Hi,
    Did this ever get implemented?
    I’d really like the list of sub-forums under the forum title when they are all private. I tried the filter mentioned above but it creates an error.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar