Skip to content

Commit

Permalink
WP_Date_Query.
Browse files Browse the repository at this point in the history
props Viper007Bond.
see #18694.

Built from https://develop.svn.wordpress.org/trunk@25139


git-svn-id: http://core.svn.wordpress.org/trunk@25119 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
nacin committed Aug 27, 2013
1 parent 7ff1bbe commit 41f1cd6
Show file tree
Hide file tree
Showing 4 changed files with 454 additions and 9 deletions.
15 changes: 15 additions & 0 deletions wp-includes/comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,15 @@ class WP_Comment_Query {
*/
var $meta_query = false;

/**
* Date query container
*
* @since 3.7.0
* @access public
* @var object WP_Date_Query
*/
var $date_query = false;

/**
* Execute the query
*
Expand Down Expand Up @@ -231,6 +240,7 @@ function query( $query_vars ) {
'meta_key' => '',
'meta_value' => '',
'meta_query' => '',
'date_query' => null, // See WP_Date_Query
);

$groupby = '';
Expand Down Expand Up @@ -360,6 +370,11 @@ function query( $query_vars ) {
$groupby = "{$wpdb->comments}.comment_ID";
}

if ( ! empty( $date_query ) && is_array( $date_query ) ) {
$date_query_object = new WP_Date_Query( $date_query, 'comment_date' );
$where .= $date_query_object->get_sql();
}

$pieces = array( 'fields', 'join', 'where', 'orderby', 'order', 'limits', 'groupby' );
$clauses = apply_filters_ref_array( 'comments_clauses', array( compact( $pieces ), &$this ) );
foreach ( $pieces as $piece )
Expand Down
Loading

0 comments on commit 41f1cd6

Please sign in to comment.