Skip to:
Content

bbPress.org

Ticket #2512: 2512.01.diff

File 2512.01.diff, 1.1 KB (added by thebrandonallen, 12 years ago)
  • includes/forums/functions.php

    diff --git includes/forums/functions.php includes/forums/functions.php
    index 050791d..881f669 100644
    function bbp_repair_forum_visibility() { 
    929929        // First, delete everything.
    930930        delete_option( '_bbp_private_forums' );
    931931        delete_option( '_bbp_hidden_forums'  );
     932       
     933        /**
     934         * Don't search for both private/hidden statuses. Since 'pre_get_posts' is an
     935         * action, it's not removed by suppress_filters. We need to make sure that
     936         * we're only searching for the supplied post_status.
     937         *
     938         * @see https://bbpress.trac.wordpress.org/ticket/2512
     939         */
     940        remove_action( 'pre_get_posts', 'bbp_pre_get_posts_normalize_forum_visibility', 4 );
    932941
    933942        // Next, get all the private and hidden forums
    934943        $private_forums = new WP_Query( array(
    function bbp_repair_forum_visibility() { 
    945954                'post_status'      => bbp_get_hidden_status_id(),
    946955                'fields'           => 'ids'
    947956        ) );
     957       
     958        // Enable forum visibilty normalization
     959        add_action( 'pre_get_posts', 'bbp_pre_get_posts_normalize_forum_visibility', 4 );
    948960
    949961        // Reset the $post global
    950962        wp_reset_postdata();