Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patching Issue #3609 #24

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 17 additions & 20 deletions src/includes/forums/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2314,33 +2314,30 @@ function bbp_pre_get_posts_normalize_forum_visibility( $posts_query = null ) {
return;
}

// Forums
if ( in_array( bbp_get_forum_post_type(), $post_types, true ) ) {

/** Default ***********************************************************/
if ( ! array_diff( $post_types, bbp_get_post_types() ) ) {

// Specific normalization for Forums Post Type
if ( in_array( bbp_get_forum_post_type(), $post_types, true ) ) {

// Add all supported forum visibilities
$posts_query->set( 'post_status', array_keys( bbp_get_forum_visibilities() ) );
// Add all supported forum visibilities
$posts_query->set( 'post_status', array_keys( bbp_get_forum_visibilities() ) );

// Get forums to exclude
$forum_ids = bbp_exclude_forum_ids( 'array' );
// Get forums to exclude
$forum_ids = bbp_exclude_forum_ids( 'array' );

// Excluding some forums
if ( ! empty( $forum_ids ) ) {
// Excluding some forums
if ( ! empty( $forum_ids ) ) {

// Get any existing not-in queries
$not_in = $posts_query->get( 'post__not_in', array() );
// Get any existing not-in queries
$not_in = $posts_query->get( 'post__not_in', array() );

// Add our not-in to existing
$not_in = array_unique( array_merge( $not_in, $forum_ids ) );
// Add our not-in to existing
$not_in = array_unique( array_merge( $not_in, $forum_ids ) );

// Set the new not-in val
$posts_query->set( 'post__not_in', $not_in );
// Set the new not-in val
$posts_query->set( 'post__not_in', $not_in );
}
}
}

// Any bbPress post type
if ( ! array_diff( $post_types, bbp_get_post_types() ) ) {

// Get forums to exclude
$forum_ids = bbp_exclude_forum_ids( 'meta_query' );
Expand Down