Making WordPress.org

Ticket #2558: 2558.patch

File 2558.patch, 1.4 KB (added by SergeyBiryukov, 8 years ago)
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-hooks.php

     
    77        public function __construct() {
    88                // Basic behavior filters and actions.
    99                add_filter( 'bbp_get_forum_pagination_count', '__return_empty_string' );
     10                add_action( 'pre_get_posts', array( $this, 'hide_non_public_forums' ) );
    1011
    1112                // Display-related filters and actions.
    1213                add_filter( 'bbp_topic_admin_links', array( $this, 'admin_links' ), 10, 3 );
     
    5354        }
    5455
    5556        /**
     57         * Remove non-public forums from lists on front end.
     58         *
     59         * By default, bbPress shows all forums to keymasters, including private and
     60         * hidden forums. This ensures that public queries include only public forums.
     61         *
     62         * @param WP_Query $query Current query object.
     63         */
     64        function hide_non_public_forums( $query ) {
     65                if ( ! is_admin() && 'forum' === $query->get( 'post_type' ) ) {
     66                        $query->set( 'post_status', 'publish' );
     67                }
     68        }
     69
     70        /**
    5671         * Remove some unneeded or redundant admin links for topics and replies,
    5772         * move less commonly used inline quick links to 'Topic Admin' sidebar section.
    5873         *