Changeset 32683 for trunk/src/wp-includes/user.php
- Timestamp:
- 06/02/2015 01:29:44 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/user.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/user.php
r32637 r32683 570 570 * include meta fields. Default 'all'. 571 571 * @type string $who Type of users to query. Accepts 'authors'. Default empty (all users). 572 * @type bool|array $has_published_posts Pass an array of post types to filter results to users who have 573 * published posts in those post types. `true` is an alias for all 574 * public post types. 572 575 * } 573 576 */ … … 593 596 'count_total' => true, 594 597 'fields' => 'all', 595 'who' => '' 598 'who' => '', 599 'has_published_posts' => null, 596 600 ) ); 597 601 } … … 650 654 $qv['meta_compare'] = '!='; 651 655 $qv['blog_id'] = $blog_id = 0; // Prevent extra meta query 656 } 657 658 if ( $qv['has_published_posts'] && $blog_id ) { 659 if ( true === $qv['has_published_posts'] ) { 660 $post_types = get_post_types( array( 'public' => true ) ); 661 } else { 662 $post_types = (array) $qv['has_published_posts']; 663 } 664 665 foreach ( $post_types as &$post_type ) { 666 $post_type = $wpdb->prepare( '%s', $post_type ); 667 } 668 669 $posts_table = $wpdb->get_blog_prefix( $blog_id ) . 'posts'; 670 $this->query_where .= " AND $wpdb->users.ID IN ( SELECT DISTINCT $posts_table.post_author FROM $posts_table WHERE $posts_table.post_status = 'publish' AND $posts_table.post_type IN ( " . join( ", ", $post_types ) . " ) )"; 652 671 } 653 672
Note: See TracChangeset
for help on using the changeset viewer.