Forums

Join
bbPress Support ForumsTroubleshootingSubforum list not displaying if all subforums are private

Info

Subforum list not displaying if all subforums are private

  1. 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

  2. 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.

  3. You must log in to post.