Changeset 3085 for branches/plugin/bbp-includes/bbp-widgets.php
- Timestamp:
- 05/03/2011 08:01:48 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-widgets.php
r3044 r3085 303 303 304 304 $title = apply_filters( 'bbp_forum_widget_title', $instance['title'] ); 305 $parent_forum = !empty( $instance['parent_forum'] ) ? $instance['parent_forum'] : 0;306 307 $ default= array(305 $parent_forum = !empty( $instance['parent_forum'] ) ? $instance['parent_forum'] : '0'; 306 307 $forums_query = array( 308 308 'post_parent' => $parent_forum, 309 309 'posts_per_page' => get_option( '_bbp_forums_per_page', 15 ), … … 312 312 ); 313 313 314 // Don't show private forums to normal users315 if ( !current_user_can( 'read_private_forums' ) && empty( $default['meta_key'] ) && empty( $default['meta_value'] ) ) {316 $default['meta_key'] = '_bbp_visibility';317 $default['meta_value'] = 'public';318 }319 320 314 bbp_set_query_name( 'bbp_widget' ); 321 315 322 if ( bbp_has_forums( $ default) ) :316 if ( bbp_has_forums( $forums_query ) ) : 323 317 324 318 echo $before_widget; … … 455 449 // Query defaults 456 450 $topics_query = array( 451 'post_parent' => $parent_forum, 457 452 'post_author' => 0, 458 453 'posts_per_page' => $max_shown > $pop_check ? $max_shown : $pop_check, 454 'posts_per_page' => $max_shown, 459 455 'show_stickies' => false, 460 'posts_per_page' => $max_shown,461 456 'order' => 'DESC', 462 457 ); 463 458 464 // Setup a meta_query to remove hidden forums465 if ( ( empty( $parent_forum ) || ( 'any' == $parent_forum ) ) && ( $hidden = bbp_get_hidden_forum_ids() ) ) {466 467 // Value and compare for meta_query468 $value = implode( ',', $hidden );469 $compare = ( 1 < count( $hidden ) ) ? 'NOT IN' : '!=';470 471 // Add meta_query to $replies_query472 $topics_query['meta_query'] = array( array(473 'key' => '_bbp_forum_id',474 'value' => $value,475 'compare' => $compare476 ) );477 $topics_query['post_parent'] = 'any';478 }479 480 459 bbp_set_query_name( 'bbp_widget' ); 460 461 // Remove any topics from hidden forums 462 $topics_query = bbp_exclude_forum_ids( $topics_query ); 481 463 482 464 if ( $pop_check < $max_shown && bbp_has_topics( $topics_query ) ) : … … 655 637 ); 656 638 657 // Setup a meta_query to remove hidden forums658 if ( $hidden = bbp_get_hidden_forum_ids() ) {659 660 // Value and compare for meta_query661 $value = implode( ',', $hidden );662 $compare = ( 1 < count( $hidden ) ) ? 'NOT IN' : '!=';663 664 // Add meta_query to $replies_query665 $replies_query['meta_query'] = array( array(666 'key' => '_bbp_forum_id',667 'value' => $value,668 'compare' => $compare669 ) );670 }671 672 639 // Set the query name 673 640 bbp_set_query_name( 'bbp_widget' ); 641 642 // Exclude hidden forums 643 $replies_query = bbp_exclude_forum_ids( $replies_query ); 674 644 675 645 // Get replies and display them
Note: See TracChangeset
for help on using the changeset viewer.