chromancer (@chromancer)

Forum Replies Created

Viewing 1 replies (of 1 total)

  • chromancer
    Participant

    @chromancer

    Hey folks, I had the same problem as you all. With no solution forthcoming, I dug down into the code and used a bunch of debug_zval_dump() statements to see the actual SQL.

    The problem is that the code is producing this query to find out whether or not you have subforums:

    SELECT ID FROM wp_posts WHERE post_parent = 31 AND post_status IN ( 'publish' ) AND post_type = 'forum' ORDER BY ID DESC
    

    But the status for your private subforums is ‘private’. You want to see this:

    SELECT ID FROM wp_posts WHERE post_parent = 31 AND post_status IN ( 'publish','private' ) AND post_type = 'forum' ORDER BY ID DESC
    

    I found this on line 1287 of bb-common-functions.php:

        $post_status = array( bbp_get_public_status_id() );
    

    That line of code is what puts the ( ‘publish’) list in the SQL. I changed it to:

        $post_status = array( bbp_get_public_status_id(), bbp_get_private_status_id() );
    

    Now my subforums are showing up correctly. To see if this fix would have any adverse affects, I created a public forum, added a private subforum and logged out. The private subforum was not visible. Seems like this fix worked for me.

    If you don’t have access to the actual source code, I’m afraid you won’t be able to do what I did, but I wanted to share that for those who do. Perhaps somebody can make some sort of plugin to help everyone else. I’m actually not a PHP guy and hardly know what I’m doing at all and I’m new to bbpress as well. If anybody comes up with anything better, I’d love to see it!

Viewing 1 replies (of 1 total)