Making WordPress.org


Ignore:
Timestamp:
07/09/2017 02:09:38 PM (9 years ago)
Author:
SergeyBiryukov
Message:

Support Forums: Limit user's "Active Topics" view to the last year on Rosetta forums, for consistency with the main forums.

See #2470.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-users.php

    r5625 r5635  
    189189
    190190        /**
    191          * Set forum ID for user's Reviews query.
     191         * Set the arguments for user's "Reviews Written" and "Active Topics" queries.
    192192         *
    193193         * @param array $args WP_Query arguments.
     
    195195         */
    196196        public function parse_user_topics_query_args( $args ) {
    197                 if ( get_query_var( 'wporg_single_user_reviews' ) ) {
    198                         $args['post_parent'] = Plugin::REVIEWS_FORUM_ID;
    199                 } elseif ( bbp_is_single_user_topics() || get_query_var( 'wporg_single_user_active_topics' ) ) {
    200                         $args['post_parent__not_in'] = array( Plugin::REVIEWS_FORUM_ID );
     197                // Forums on https://wordpress.org/support/.
     198                if ( defined( 'WPORG_SUPPORT_FORUMS_BLOGID' ) && WPORG_SUPPORT_FORUMS_BLOGID == get_current_blog_id() ) {
     199
     200                        // Set forum ID for topic and review queries.
     201                        if ( get_query_var( 'wporg_single_user_reviews' ) ) {
     202                                $args['post_parent'] = Plugin::REVIEWS_FORUM_ID;
     203                        } elseif ( bbp_is_single_user_topics() || get_query_var( 'wporg_single_user_active_topics' ) ) {
     204                                $args['post_parent__not_in'] = array( Plugin::REVIEWS_FORUM_ID );
     205                        }
     206
     207                // Rosetta forums.
     208                } else {
     209
     210                        // Only look at the last year of topics for user's "Active Topics" view.
     211                        // For the main forums, the same is done in Performance_Optimizations::has_topics().
     212                        if ( get_query_var( 'wporg_single_user_active_topics' ) ) {
     213                                $args['date_query'] = array( array(
     214                                        'after' => '1 year ago',
     215                                ) );
     216                        }
    201217                }
    202218
Note: See TracChangeset for help on using the changeset viewer.