Changeset 4023
- Timestamp:
- 09/09/2016 05:59:50 PM (9 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-directory-compat.php
r4010 r4023 59 59 60 60 // Compat views are hooked in a special order, and need help with feed queries. 61 if ( isset( $query_vars['bbp_view'] ) && in_array( $query_vars['bbp_view'], array( $this->compat(), 'reviews' ) ) ) {61 if ( isset( $query_vars['bbp_view'] ) && in_array( $query_vars['bbp_view'], array( $this->compat(), 'reviews', 'active' ) ) ) { 62 62 $this->query = $query_vars; 63 63 add_filter( 'bbp_get_view_query_args', array( $this, 'get_view_query_args_for_feed' ), 10, 2 ); … … 79 79 ) ), 80 80 'show_stickies' => false, 81 'orderby' => 'ID', 81 82 ); 82 83 break; … … 86 87 return array( 87 88 'post_parent' => Plugin::REVIEWS_FORUM_ID, 89 'tax_query' => array( array( 90 'taxonomy' => $this->taxonomy(), 91 'field' => 'slug', 92 'terms' => $this->query[ $this->query_var() ], 93 ) ), 94 'show_stickies' => false, 95 'orderby' => 'ID', 96 ); 97 break; 98 99 // Return active topics from the support forum. 100 case 'active' : 101 return array( 102 'post_parent' => $this->forum_id(), 103 'post_status' => 'publish', 88 104 'tax_query' => array( array( 89 105 'taxonomy' => $this->taxonomy(), … … 244 260 ) ), 245 261 'show_stickies' => false, 262 'meta_key' => null, 263 'meta_compare' => null, 246 264 'orderby' => 'ID', 247 265 ) … … 260 278 ) ), 261 279 'show_stickies' => false, 280 'meta_key' => null, 281 'meta_compare' => null, 262 282 'orderby' => 'ID', 263 283 ) … … 270 290 array( 271 291 'post_parent' => $this->forum_id(), 272 'meta_query' => array( array( 273 'key' => '_bbp_last_active_time', 274 'type' => 'DATETIME', 275 ) ), 292 'post_status' => 'publish', 276 293 'tax_query' => array( array( 277 294 'taxonomy' => $this->taxonomy(), … … 280 297 ) ), 281 298 'show_stickies' => false, 282 'orderby' => 'meta_value',283 299 ) 284 300 ); … … 336 352 $r[1] = '<a href="' . esc_url( bbp_get_forum_permalink( $this->forum_id() ) ) . '" class="bbp-breadcrumb-forum">' . esc_html( bbp_get_forum_title( $this->forum_id() ) ) . '</a>'; 337 353 $r[2] = esc_html( $this->title() ); 338 if ( 'reviews' == $view) {354 if ( in_array( $view, array( 'reviews', 'active' ) ) ) { 339 355 $r[2] = '<a href="' . esc_url( bbp_get_view_url( $this->compat() ) ) . '" class="bbp-breadcrumb-forum">' . esc_html( $this->title() ) . '</a>'; 340 $r[3] = __( 'Reviews', 'wporg-forums' ); 356 if ( 'reviews' == $view ) { 357 $r[3] = __( 'Reviews', 'wporg-forums' ); 358 } else { 359 $r[3] = __( 'Active Topics', 'wporg-forums' ); 360 } 341 361 } 342 362 return $r; -
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-performance-optimizations.php
r3971 r4023 126 126 */ 127 127 if ( isset( $r['post_type'] ) && 'topic' == $r['post_type'] ) { 128 128 129 // Theme and plugin views rely on taxonomy queries. 129 130 if ( isset( $r['tax_query'] ) ) { 131 132 // Only look at the last year of topics for the active view. 133 if ( bbp_is_single_view() && bbp_get_view_id() == 'active' ) { 134 add_filter( 'posts_where', array( $this, 'posts_in_last_year' ) ); 135 } 130 136 return $r; 131 137 } … … 184 190 185 191 $bound_id = $this->get_bound_id( '6 MONTH' ); 192 $w .= $wpdb->prepare( " AND ( $wpdb->posts.ID >= %d )", $bound_id ); 193 return $w; 194 } 195 196 public function posts_in_last_year( $w ) { 197 global $wpdb; 198 199 $bound_id = $this->get_bound_id( '1 YEAR' ); 186 200 $w .= $wpdb->prepare( " AND ( $wpdb->posts.ID >= %d )", $bound_id ); 187 201 return $w;
Note: See TracChangeset
for help on using the changeset viewer.