Changeset 7262
- Timestamp:
- 06/28/2024 06:06:30 PM (8 months ago)
- Location:
- branches/2.6/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.6/src/includes/forums/functions.php
r7208 r7262 2309 2309 } 2310 2310 2311 // Get query post types array . 2312 $post_types = (array) $posts_query->get( 'post_type' ); 2311 // Bail to prevent unintended wp-admin post_row overrides 2312 if ( is_admin() && isset( $_REQUEST['post_status'] ) ) { 2313 return; 2314 } 2315 2316 // Get query post types as an array. 2317 $post_types = array_filter( (array) $posts_query->get( 'post_type' ) ); 2313 2318 2314 2319 // Forums 2315 if ( bbp_get_forum_post_type() === implode( '', $post_types ) ) { 2316 2317 // Prevent accidental wp-admin post_row override 2318 if ( is_admin() && isset( $_REQUEST['post_status'] ) ) { 2319 return; 2320 } 2320 if ( in_array( bbp_get_forum_post_type(), $post_types, true ) ) { 2321 2321 2322 2322 /** Default ***********************************************************/ … … 2326 2326 2327 2327 // Get forums to exclude 2328 $ hidden_ids = bbp_exclude_forum_ids( 'array' );2329 2330 // Bail if no forums to exclude2331 if ( empty( $hidden_ids ) ) {2332 return; 2333 }2334 2335 // Get any existing meta queries 2336 $not_in = $posts_query->get( 'post__not_in', array() );2337 2338 // Add our meta query to existing 2339 $not_in = array_unique( array_merge( $not_in, $hidden_ids ) );2340 2341 // Set the meta_query var2342 $posts_query->set( 'post__not_in', $not_in );2328 $forum_ids = bbp_exclude_forum_ids( 'array' ); 2329 2330 // Excluding some forums 2331 if ( ! empty( $forum_ids ) ) { 2332 2333 // Get any existing not-in queries 2334 $not_in = $posts_query->get( 'post__not_in', array() ); 2335 2336 // Add our not-in to existing 2337 $not_in = array_unique( array_merge( $not_in, $forum_ids ) ); 2338 2339 // Set the new not-in val 2340 $posts_query->set( 'post__not_in', $not_in ); 2341 } 2342 } 2343 2343 2344 2344 // Some other post type besides Forums, Topics, or Replies 2345 } elseif ( ! array_diff( $post_types, bbp_get_post_types() ) ) {2345 if ( ! array_diff( $post_types, bbp_get_post_types() ) ) { 2346 2346 2347 2347 // Get forums to exclude 2348 2348 $forum_ids = bbp_exclude_forum_ids( 'meta_query' ); 2349 2349 2350 // Bail if no forums to exclude 2351 if ( empty( $forum_ids ) ) { 2352 return; 2353 } 2354 2355 // Get any existing meta queries 2356 $meta_query = (array) $posts_query->get( 'meta_query', array() ); 2357 2358 // Add our meta query to existing 2359 $meta_query[] = $forum_ids; 2360 2361 // Set the meta_query var 2362 $posts_query->set( 'meta_query', $meta_query ); 2350 // Excluding some forums 2351 if ( ! empty( $forum_ids ) ) { 2352 2353 // Get any existing meta queries 2354 $meta_query = (array) $posts_query->get( 'meta_query', array() ); 2355 2356 // Add our meta query to existing 2357 $meta_query[] = $forum_ids; 2358 2359 // Set the new meta_query val 2360 $posts_query->set( 'meta_query', $meta_query ); 2361 } 2363 2362 } 2364 2363 } -
branches/2.6/src/includes/search/template.php
r7176 r7262 47 47 } 48 48 49 // What are the default allowed statuses (based on user caps) 50 if ( bbp_get_view_all() ) { 51 52 // Default view=all statuses 53 $post_statuses = array_keys( bbp_get_topic_statuses() ); 54 55 // Add support for private status 56 if ( current_user_can( 'read_private_topics' ) ) { 57 $post_statuses[] = bbp_get_private_status_id(); 58 } 59 60 // Join post statuses together 61 $default['post_status'] = $post_statuses; 62 63 // Lean on the 'perm' query var value of 'readable' to provide statuses 64 } else { 65 $default['perm'] = 'readable'; 66 } 49 // Default public statuses (topics coincidentally cover all post types) 50 $post_statuses = array_keys( bbp_get_public_topic_statuses() ); 51 52 // Add support for private status 53 if ( current_user_can( 'read_private_topics' ) ) { 54 $post_statuses[] = bbp_get_private_status_id(); 55 } 56 57 // Add support for hidden status 58 if ( current_user_can( 'read_hidden_topics' ) ) { 59 $post_statuses[] = bbp_get_hidden_status_id(); 60 } 61 62 // Join post statuses together 63 $default['post_status'] = $post_statuses; 67 64 68 65 /** Setup *****************************************************************/ -
branches/2.6/src/templates/default/bbpress/content-search.php
r7049 r7262 15 15 <div id="bbpress-forums" class="bbpress-wrapper"> 16 16 17 <?php bbp_get_template_part( 'form', 'search' ); ?> 18 17 19 <?php bbp_breadcrumb(); ?> 18 20 … … 29 31 <?php bbp_get_template_part( 'pagination', 'search' ); ?> 30 32 31 <?php else if ( bbp_get_search_terms() ): ?>33 <?php else : ?> 32 34 33 35 <?php bbp_get_template_part( 'feedback', 'no-search' ); ?> 34 35 <?php else : ?>36 37 <?php bbp_get_template_part( 'form', 'search' ); ?>38 36 39 37 <?php endif; ?> -
branches/2.6/src/templates/default/bbpress/feedback-no-search.php
r6258 r7262 11 11 defined( 'ABSPATH' ) || exit; 12 12 13 ?>13 if ( bbp_get_search_terms() ) : ?> 14 14 15 15 <div class="bbp-template-notice"> … … 18 18 </ul> 19 19 </div> 20 21 <?php else : ?> 22 23 <div class="bbp-template-notice"> 24 <ul> 25 <li><?php esc_html_e( 'Please enter some search terms.', 'bbpress' ); ?></li> 26 </ul> 27 </div> 28 29 <?php endif;
Note: See TracChangeset
for help on using the changeset viewer.