WordPress.org

Making WordPress.org

Changeset 4848


Ignore:
Timestamp:
02/01/2017 01:28:56 AM (5 years ago)
Author:
SergeyBiryukov
Message:

Support Theme: Limit No Replies view to 21 days by default.

Fixes #2190.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php

    r4847 r4848  
    123123    unset( $view_count, $view_iterator, $view, $found, $all, $ordered );
    124124}
     125
     126/**
     127 * Limit No Replies view to 21 days by default.
     128 *
     129 * @param array $args
     130 * @return array
     131 */
     132function wporg_support_limit_no_replies_view( $args ) {
     133    $days = 21;
     134
     135    if ( isset( $_GET['days'] ) ) {
     136        $days = (int) $_GET['days'];
     137    }
     138
     139    $args['date_query'] = array(
     140        array(
     141            'after'  => sprintf( '%s days ago', $days ),
     142        ),
     143    );
     144
     145    return $args;
     146}
     147add_filter( 'bbp_register_view_no_replies', 'wporg_support_limit_no_replies_view' );
    125148
    126149/**
Note: See TracChangeset for help on using the changeset viewer.