IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 6 | 6 | */ |
| 7 | 7 | class Tests_User extends WP_UnitTestCase { |
| 8 | 8 | |
| | 9 | function test_get_user_by_user_registered() { |
| | 10 | |
| | 11 | $date_query_test_args = array(); |
| | 12 | |
| | 13 | // users registered last 30 days |
| | 14 | $date_query_test_args[] = array( |
| | 15 | 'after' => '-30 days' |
| | 16 | ); |
| | 17 | |
| | 18 | // users registered in current month |
| | 19 | $date_query_test_args[] = array( |
| | 20 | 'month' => gmdate( 'n' ) |
| | 21 | ); |
| | 22 | |
| | 23 | // users registered dayofweek between 2 and 6 AND before 01.01.2014 |
| | 24 | $date_query_test_args[] = array( |
| | 25 | array( |
| | 26 | 'dayofweek' => array( 2, 6 ), |
| | 27 | 'compare' => 'BETWEEN', |
| | 28 | ), |
| | 29 | array( |
| | 30 | 'before' => 'January 1st, 2014' |
| | 31 | ), |
| | 32 | 'relation' => 'AND' |
| | 33 | ); |
| | 34 | |
| | 35 | foreach ( $date_query_test_args as $query_test_arg ) { |
| | 36 | |
| | 37 | $user = new WP_User_Query( array( |
| | 38 | 'date_query' => $query_test_arg |
| | 39 | ) ); |
| | 40 | |
| | 41 | // creating a date_query-object to compare the WP_User_Query-Where with the WP_Date_Query-Date |
| | 42 | $date_query = new WP_Date_Query( $query_test_arg, 'user_registered' ); |
| | 43 | $this->assertEquals( $user->query_where, 'WHERE 1=1' . $date_query->get_sql() ); |
| | 44 | |
| | 45 | } |
| | 46 | |
| | 47 | } |
| | 48 | |
| 9 | 49 | function test_get_users_of_blog() { |
| 10 | 50 | // add one of each user role |
| 11 | 51 | $nusers = array(); |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 455 | 455 | 'meta_key' => '', |
| 456 | 456 | 'meta_value' => '', |
| 457 | 457 | 'meta_compare' => '', |
| | 458 | 'date_query' => '', |
| 458 | 459 | 'include' => array(), |
| 459 | 460 | 'exclude' => array(), |
| 460 | 461 | 'search' => '', |
| … |
… |
|
| 632 | 633 | } elseif ( ! empty( $qv['exclude'] ) ) { |
| 633 | 634 | $ids = implode( ',', wp_parse_id_list( $qv['exclude'] ) ); |
| 634 | 635 | $this->query_where .= " AND $wpdb->users.ID NOT IN ($ids)"; |
| | 636 | } |
| | 637 | |
| | 638 | // adding the date_query-Search for user_registered |
| | 639 | if ( !empty( $qv[ 'date_query' ] ) ) { |
| | 640 | |
| | 641 | $date_query = new WP_Date_Query( |
| | 642 | $qv[ 'date_query' ], |
| | 643 | 'user_registered' |
| | 644 | ); |
| | 645 | $this->query_where .= $date_query->get_sql(); |
| | 646 | |
| 635 | 647 | } |
| 636 | 648 | |
| 637 | 649 | /** |
| … |
… |
|
| 1996 | 2008 | wp_new_user_notification( $user_id, $user_pass ); |
| 1997 | 2009 | |
| 1998 | 2010 | return $user_id; |
| 1999 | | } |
| | 2011 | } |
| | 2012 | No newline at end of file |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 164 | 164 | public function validate_column( $column ) { |
| 165 | 165 | $valid_columns = array( |
| 166 | 166 | 'post_date', 'post_date_gmt', 'post_modified', |
| 167 | | 'post_modified_gmt', 'comment_date', 'comment_date_gmt' |
| | 167 | 'post_modified_gmt', 'comment_date', 'comment_date_gmt', |
| | 168 | 'user_registered' |
| 168 | 169 | ); |
| 169 | 170 | /** |
| 170 | 171 | * Filter the list of valid date query columns. |
| … |
… |
|
| 172 | 173 | * @since 3.7.0 |
| 173 | 174 | * |
| 174 | 175 | * @param array $valid_columns An array of valid date query columns. Defaults are 'post_date', 'post_date_gmt', |
| 175 | | * 'post_modified', 'post_modified_gmt', 'comment_date', 'comment_date_gmt' |
| | 176 | * 'post_modified', 'post_modified_gmt', 'comment_date', 'comment_date_gmt', 'user_registered' |
| 176 | 177 | */ |
| 177 | 178 | if ( ! in_array( $column, apply_filters( 'date_query_valid_columns', $valid_columns ) ) ) |
| 178 | 179 | $column = 'post_date'; |