Changeset 3972
- Timestamp:
- 09/05/2016 11:33:22 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-directory-compat.php
r3962 r3972 20 20 var $authors = null; 21 21 var $contributors = null; 22 var $query = null; 22 23 23 24 public function init() { 24 25 if ( defined( 'WPORG_SUPPORT_FORUMS_BLOGID' ) && get_current_blog_id() == WPORG_SUPPORT_FORUMS_BLOGID ) { 26 // Intercept feed requests prior to bbp_request_feed_trap. 27 add_filter( 'bbp_request', array( $this, 'request' ), 9 ); 28 25 29 // Define the taxonomy and query vars for this view. 26 30 add_action( 'plugins_loaded', array( $this, 'always_load' ) ); … … 42 46 add_action( 'bbp_new_topic_post_extras', array( $this, 'topic_post_extras' ) ); 43 47 } 48 } 49 50 /** 51 * Handle view feeds for this compat. 52 */ 53 public function request( $query_vars ) { 54 if ( isset( $query_vars['feed'] ) && isset( $query_vars[ $this->query_var() ] ) ) { 55 56 // Compat views are hooked in a special order, and need help with feed queries. 57 if ( isset( $query_vars['bbp_view'] ) && in_array( $query_vars['bbp_view'], array( $this->compat(), 'reviews' ) ) ) { 58 $this->query = $query_vars; 59 add_filter( 'bbp_get_view_query_args', array( $this, 'get_view_query_args_for_feed' ), 10, 2 ); 60 } 61 } 62 return $query_vars; 63 } 64 65 public function get_view_query_args_for_feed( $retval, $view ) { 66 switch ( $this->query['bbp_view'] ) { 67 // Return new topics from the support forum. 68 case $this->compat() : 69 return array( 70 'post_parent' => $this->forum_id(), 71 'tax_query' => array( array( 72 'taxonomy' => $this->taxonomy(), 73 'field' => 'slug', 74 'terms' => $this->query[ $this->query_var() ], 75 ) ), 76 'show_stickies' => false, 77 ); 78 break; 79 80 // Return new topics from the reviews forum. 81 case 'reviews' : 82 return array( 83 'post_parent' => Plugin::REVIEWS_FORUM_ID, 84 'tax_query' => array( array( 85 'taxonomy' => $this->taxonomy(), 86 'field' => 'slug', 87 'terms' => $this->query[ $this->query_var() ], 88 ) ), 89 'show_stickies' => false, 90 ); 91 break; 92 } 93 return $retval; 44 94 } 45 95
Note: See TracChangeset
for help on using the changeset viewer.