Changes from trunk/wp-includes/user.php at r18178 to branches/3.1/wp-includes/user.php at r17635
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.1/wp-includes/user.php
r18178 r17635 166 166 * 167 167 * @since 3.0.0 168 * @param array $user_ids Array of user IDs. 169 * @param string|array $post_type Optional. Post type to check. Defaults to post. 168 * @param array $users User ID number list. 170 169 * @return array Amount of posts each user has written. 171 170 */ 172 function count_many_users_posts($users , $post_type = 'post') {171 function count_many_users_posts($users) { 173 172 global $wpdb; 174 173 175 174 $count = array(); 176 if ( empty( $users ) || ! is_array( $users ) )175 if ( ! is_array($users) || empty( $users ) ) 177 176 return $count; 178 177 179 $userlist = implode( ',', array_map( 'absint', $users ));180 $where = get_posts_by_author_sql( $post_type);178 $userlist = implode( ',', $users ); 179 $where = get_posts_by_author_sql( 'post' ); 181 180 182 181 $result = $wpdb->get_results( "SELECT post_author, COUNT(*) FROM $wpdb->posts $where AND post_author IN ($userlist) GROUP BY post_author", ARRAY_N ); … … 362 361 var $query_limit; 363 362 363 /** 364 * PHP4 constructor 365 */ 366 function WP_User_Query( $query = null ) { 367 $this->__construct( $query ); 368 } 364 369 365 370 /** … … 384 389 'orderby' => 'login', 385 390 'order' => 'ASC', 386 'offset' => '', 387 'number' => '', 391 'offset' => '', 'number' => '', 388 392 'count_total' => true, 389 393 'fields' => 'all', … … 419 423 $this->query_fields = "$wpdb->users.ID"; 420 424 } 421 422 if ( $this->query_vars['count_total'] )423 $this->query_fields = 'SQL_CALC_FOUND_ROWS ' . $this->query_fields;424 425 425 426 $this->query_from = "FROM $wpdb->users"; … … 496 497 if ( 'authors' == $qv['who'] && $blog_id ) { 497 498 $qv['meta_key'] = $wpdb->get_blog_prefix( $blog_id ) . 'user_level'; 498 $qv['meta_value'] = 0;499 $qv['meta_value'] = '_wp_zero_value'; // Hack to pass '0' 499 500 $qv['meta_compare'] = '!='; 500 501 $qv['blog_id'] = $blog_id = 0; // Prevent extra meta query 501 502 } 503 504 _parse_meta_query( $qv ); 502 505 503 506 $role = trim( $qv['role'] ); … … 515 518 } 516 519 517 $meta_query = new WP_Meta_Query(); 518 $meta_query->parse_query_vars( $qv ); 519 520 if ( !empty( $meta_query->queries ) ) { 521 $clauses = $meta_query->get_sql( 'user', $wpdb->users, 'ID', $this ); 520 if ( !empty( $qv['meta_query'] ) ) { 521 $clauses = call_user_func_array( '_get_meta_sql', array( $qv['meta_query'], 'user', $wpdb->users, 'ID', &$this ) ); 522 522 $this->query_from .= $clauses['join']; 523 523 $this->query_where .= $clauses['where']; 524 525 if ( 'OR' == $meta_query->relation )526 $this->query_fields = 'DISTINCT ' . $this->query_fields;527 524 } 528 525 … … 554 551 555 552 if ( $this->query_vars['count_total'] ) 556 $this->total_users = $wpdb->get_var( apply_filters( 'found_users_query', 'SELECT FOUND_ROWS()' ));553 $this->total_users = $wpdb->get_var("SELECT COUNT(*) $this->query_from $this->query_where"); 557 554 558 555 if ( !$this->results ) … … 744 741 * Add meta data field to a user. 745 742 * 746 * Post meta data is called "Custom Fields" on the Administration Screens.743 * Post meta data is called "Custom Fields" on the Administration Panels. 747 744 * 748 745 * @since 3.0.0 … … 1359 1356 * 'user_email' - A string containing the user's email address. 1360 1357 * 'display_name' - A string that will be shown on the site. Defaults to user's 1361 * username. It is likely that you will want to change this, for appearance. 1358 * username. It is likely that you will want to change this, for both 1359 * appearance and security through obscurity (that is if you don't use and 1360 * delete the default 'admin' user). 1362 1361 * 'nickname' - The user's nickname, defaults to the user's username. 1363 1362 * 'first_name' - The user's first name.
Note: See TracChangeset
for help on using the changeset viewer.