Skip to:
Content
Pages
Categories
Search
Top
Bottom

Subforum list not displaying if all subforums are private

  • 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 1 replies (of 1 total)

  • John James Jacoby
    Keymaster

    @johnjamesjacoby

    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.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.