Index: sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-directory-compat.php =================================================================== --- sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-directory-compat.php (revision 5050) +++ sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-directory-compat.php (working copy) @@ -5,6 +5,7 @@ abstract class Directory_Compat { abstract protected function compat(); + abstract protected function compat_views(); abstract protected function compat_title(); abstract protected function reviews_title(); abstract protected function activity_title(); @@ -109,7 +110,7 @@ if ( isset( $query_vars['feed'] ) && isset( $query_vars[ $this->query_var() ] ) ) { // Compat views are hooked in a special order, and need help with feed queries. - if ( isset( $query_vars['bbp_view'] ) && in_array( $query_vars['bbp_view'], array( $this->compat(), 'reviews', 'active' ) ) ) { + if ( isset( $query_vars['bbp_view'] ) && in_array( $query_vars['bbp_view'], $this->compat_views() ) ) { $this->query = $query_vars; add_filter( 'bbp_get_view_query_args', array( $this, 'get_view_query_args_for_feed' ), 10, 2 ); @@ -172,8 +173,7 @@ $this->{$this->compat()} = $object; switch ( $this->query['bbp_view'] ) { - case 'plugin': - case 'theme': + case $this->compat(): $translation = $this->compat_title(); break; case 'reviews': @@ -182,6 +182,9 @@ case 'active': $translation = $this->activity_title(); break; + case 'unresolved': + $translation = $this->unresolved_title(); + break; } return $translation; @@ -230,6 +233,25 @@ 'show_stickies' => false, ); break; + + // Return unresolved topics from the support forum. + case 'unresolved' : + return array( + 'post_parent' => $this->forum_id(), + 'post_status' => 'publish', + 'tax_query' => array( array( + 'taxonomy' => $this->taxonomy(), + 'field' => 'slug', + 'terms' => $this->query[ $this->query_var() ], + ) ), + 'meta_key' => 'topic_resolved', + 'meta_type' => 'CHAR', + 'meta_value' => 'no', + 'meta_compare' => '=', + 'show_stickies' => false, + 'orderby' => 'ID', + ); + break; } return $retval; } @@ -344,7 +366,7 @@ || ( bbp_is_single_forum() && Plugin::REVIEWS_FORUM_ID == bbp_get_forum_id() ) || - ( bbp_is_single_view() && ! in_array( bbp_get_view_id(), array( 'plugin', 'theme', 'reviews', 'active' ) ) ) + ( bbp_is_single_view() && ! in_array( bbp_get_view_id(), $this->compat_views() ) ) ) { $terms = get_the_terms( $topic_id, $this->taxonomy() ); if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) { @@ -357,16 +379,18 @@ } public function add_rewrite_rules() { - $priority = 'top'; + $priority = 'top'; - $root_id = $this->compat(); - $root_var = $this->query_var(); - $review_id = 'reviews'; - $active_id = 'active'; + $root_id = $this->compat(); + $root_var = $this->query_var(); + $review_id = 'reviews'; + $active_id = 'active'; + $unresolved_id = 'unresolved'; - $support_rule = $this->compat() . '/([^/]+)/'; - $reviews_rule = $this->compat() . '/([^/]+)/' . $review_id . '/'; - $active_rule = $this->compat() . '/([^/]+)/' . $active_id . '/'; + $support_rule = $this->compat() . '/([^/]+)/'; + $reviews_rule = $this->compat() . '/([^/]+)/' . $review_id . '/'; + $active_rule = $this->compat() . '/([^/]+)/' . $active_id . '/'; + $unresolved_rule = $this->compat() . '/([^/]+)/' . $unresolved_id . '/'; $feed_id = 'feed'; $view_id = bbp_get_view_rewrite_id(); @@ -393,6 +417,11 @@ add_rewrite_rule( $active_rule . $base_rule, 'index.php?' . $view_id . '=' . $active_id . '&' . $root_var . '=$matches[1]', $priority ); add_rewrite_rule( $active_rule . $paged_rule, 'index.php?' . $view_id . '=' . $active_id . '&' . $root_var . '=$matches[1]&' . $paged_id . '=$matches[2]', $priority ); add_rewrite_rule( $active_rule . $feed_rule, 'index.php?' . $view_id . '=' . $active_id . '&' . $root_var . '=$matches[1]&' . $feed_id . '=$matches[2]', $priority ); + + // Add unresolved view rewrite rules. + add_rewrite_rule( $unresolved_rule . $base_rule, 'index.php?' . $view_id . '=' . $unresolved_id . '&' . $root_var . '=$matches[1]', $priority ); + add_rewrite_rule( $unresolved_rule . $paged_rule, 'index.php?' . $view_id . '=' . $unresolved_id . '&' . $root_var . '=$matches[1]&' . $paged_id . '=$matches[2]', $priority ); + add_rewrite_rule( $unresolved_rule . $feed_rule, 'index.php?' . $view_id . '=' . $unresolved_id . '&' . $root_var . '=$matches[1]&' . $feed_id . '=$matches[2]', $priority ); } public function add_query_var( $query_vars ) { @@ -459,6 +488,27 @@ 'show_stickies' => false, ) ); + + // Add unresolved topics view. + bbp_register_view( + 'unresolved', + $this->unresolved_title(), + array( + 'post_parent' => $this->forum_id(), + 'post_status' => 'publish', + 'tax_query' => array( array( + 'taxonomy' => $this->taxonomy(), + 'field' => 'slug', + 'terms' => $this->slug(), + ) ), + 'meta_key' => 'topic_resolved', + 'meta_type' => 'CHAR', + 'meta_value' => 'no', + 'meta_compare' => '=', + 'orderby' => 'ID', + 'show_stickies' => false, + ) + ); } /** @@ -468,7 +518,7 @@ global $wp_rewrite; $view = bbp_get_view_id( $view ); - if ( ! in_array( $view, array( 'active', 'reviews', $this->compat() ) ) ) { + if ( ! in_array( $view, $this->compat_views() ) ) { return $url; } @@ -475,8 +525,9 @@ // Pretty permalinks. if ( $wp_rewrite->using_permalinks() ) { switch ( $view ) { + case 'reviews' : case 'active' : - case 'reviews' : + case 'unresolved' : $url = $wp_rewrite->root . $this->compat() . '/' . $this->slug() . '/' . $view; break; @@ -506,7 +557,7 @@ } $view = bbp_get_view_id(); - if ( ! in_array( $view, array( $this->compat(), 'reviews', 'active' ) ) ) { + if ( ! in_array( $view, $this->compat_views() ) ) { return $r; } @@ -521,7 +572,7 @@ $r[1] = sprintf( $compat_breadcrumb, esc_html( $this->title() ) ); - if ( in_array( $view, array( 'reviews', 'active' ) ) ) { + if ( in_array( $view, array( 'reviews', 'active', 'unresolved' ) ) ) { $r[1] = sprintf( $compat_breadcrumb, sprintf( '%s', esc_url( bbp_get_view_url( $this->compat() ) ), @@ -529,8 +580,10 @@ ) ); if ( 'reviews' == $view ) { $r[2] = __( 'Reviews', 'wporg-forums' ); + } elseif ( 'active' == $view ) { + $r[2] = __( 'Active Topics', 'wporg-forums' ); } else { - $r[2] = __( 'Active Topics', 'wporg-forums' ); + $r[2] = __( 'Unresolved Topics', 'wporg-forums' ); } } return $r; Index: sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-performance-optimizations.php =================================================================== --- sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-performance-optimizations.php (revision 5050) +++ sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-performance-optimizations.php (working copy) @@ -214,7 +214,7 @@ $this->query = $r; } - if ( bbp_is_single_view() && ! in_array( bbp_get_view_id(), array( 'plugin', 'theme', 'reviews', 'active' ) ) ) { + if ( bbp_is_single_view() && ! in_array( bbp_get_view_id(), array( 'plugin', 'theme', 'reviews', 'active', 'unresolved' ) ) ) { $r['post_parent__not_in'] = array( Plugin::THEMES_FORUM_ID, Plugin::PLUGINS_FORUM_ID, Plugin::REVIEWS_FORUM_ID ); } } Index: sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-plugin-directory-compat.php =================================================================== --- sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-plugin-directory-compat.php (revision 5050) +++ sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-plugin-directory-compat.php (working copy) @@ -13,6 +13,10 @@ return self::COMPAT; } + function compat_views() { + return array( self::COMPAT, 'reviews', 'active', 'unresolved' ); + } + function compat_title() { /* translators: %s: plugin title */ return sprintf( _x( '[%s] Support', 'plugin', 'wporg-forums' ), $this->title() ); @@ -28,6 +32,11 @@ return sprintf( _x( '[%s] Recent Activity', 'plugin', 'wporg-forums' ), $this->title() ); } + function unresolved_title() { + /* translators: %s: plugin title */ + return sprintf( _x( '[%s] Unresolved Topics', 'plugin', 'wporg-forums' ), $this->title() ); + } + function slug() { return $this->slug; } @@ -83,12 +92,13 @@ include_once WPORGPATH . 'extend/plugins-plugins/_plugin-icons.php'; } - $plugin = sprintf( '%s', esc_attr( $this->slug() ), esc_html( $this->plugin->post_title ) ); - $faq = sprintf( '%s', esc_attr( $this->slug() ), __( 'Frequently Asked Questions', 'wporg-forums' ) ); - $support = sprintf( '%s', esc_attr( $this->slug() ), __( 'Support Threads', 'wporg-forums' ) ); - $active = sprintf( '%s', esc_attr( $this->slug() ), __( 'Active Topics', 'wporg-forums' ) ); - $reviews = sprintf( '%s', esc_attr( $this->slug() ), __( 'Reviews', 'wporg-forums' ) ); - $create = ''; + $plugin = sprintf( '%s', esc_attr( $this->slug() ), esc_html( $this->plugin->post_title ) ); + $faq = sprintf( '%s', esc_attr( $this->slug() ), __( 'Frequently Asked Questions', 'wporg-forums' ) ); + $support = sprintf( '%s', esc_attr( $this->slug() ), __( 'Support Threads', 'wporg-forums' ) ); + $active = sprintf( '%s', esc_attr( $this->slug() ), __( 'Active Topics', 'wporg-forums' ) ); + $unresolved = sprintf( '%s', esc_attr( $this->slug() ), __( 'Unresolved Topics', 'wporg-forums' ) ); + $reviews = sprintf( '%s', esc_attr( $this->slug() ), __( 'Reviews', 'wporg-forums' ) ); + $create = ''; $create_label = ''; if ( isset( $this->ratings ) && $this->ratings->is_rating_view() && bbp_current_user_can_access_create_topic_form() ) { @@ -115,6 +125,7 @@
+ Index: sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-theme-directory-compat.php =================================================================== --- sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-theme-directory-compat.php (revision 5050) +++ sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-theme-directory-compat.php (working copy) @@ -13,6 +13,10 @@ return self::COMPAT; } + function compat_views() { + return array( self::COMPAT, 'reviews', 'active', 'unresolved' ); + } + function compat_title() { /* translators: %s: theme title */ return sprintf( _x( '[%s] Support', 'theme', 'wporg-forums' ), $this->title() ); @@ -28,6 +32,11 @@ return sprintf( _x( '[%s] Recent Activity', 'theme', 'wporg-forums' ), $this->title() ); } + function unresolved_title() { + /* translators: %s: theme title */ + return sprintf( _x( '[%s] Unresolved Topics', 'theme', 'wporg-forums' ), $this->title() ); + } + function slug() { return $this->slug; } @@ -79,11 +88,12 @@ } public function do_topic_sidebar() { - $theme = sprintf( '%s', esc_attr( $this->slug() ), esc_html( $this->theme->post_title ) ); - $support = sprintf( '%s', esc_attr( $this->slug() ), __( 'Support Threads', 'wporg-forums' ) ); - $active = sprintf( '%s', esc_attr( $this->slug() ), __( 'Active Topics', 'wporg-forums' ) ); - $reviews = sprintf( '%s', esc_attr( $this->slug() ), __( 'Reviews', 'wporg-forums' ) ); - $create = ''; + $theme = sprintf( '%s', esc_attr( $this->slug() ), esc_html( $this->theme->post_title ) ); + $support = sprintf( '%s', esc_attr( $this->slug() ), __( 'Support Threads', 'wporg-forums' ) ); + $active = sprintf( '%s', esc_attr( $this->slug() ), __( 'Active Topics', 'wporg-forums' ) ); + $unresolved = sprintf( '%s', esc_attr( $this->slug() ), __( 'Unresolved Topics', 'wporg-forums' ) ); + $reviews = sprintf( '%s', esc_attr( $this->slug() ), __( 'Reviews', 'wporg-forums' ) ); + $create = ''; $create_label = ''; if ( isset( $this->ratings ) && $this->ratings->is_rating_view() && bbp_current_user_can_access_create_topic_form() ) { @@ -103,6 +113,7 @@ + Index: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php =================================================================== --- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php (revision 5050) +++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php (working copy) @@ -232,7 +232,7 @@ * @return array Array of compat views. */ function wporg_support_get_compat_views() { - return array( 'theme', 'plugin', 'reviews', 'active' ); + return array( 'theme', 'plugin', 'reviews', 'active', 'unresolved' ); } /**