Changeset 15579
- Timestamp:
- 09/06/2010 08:09:41 AM (14 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/functions.php
r15574 r15579 4245 4245 * @param array $queries An array of queries 4246 4246 * @param string $meta_id_column The column that holds the object id 4247 * @param string $table Which meta table to look in4248 4247 * @return string 4249 4248 */ 4250 function _wp_meta_sql( $queries, $meta_id_column , $table) {4249 function _wp_meta_sql( $queries, $meta_id_column ) { 4251 4250 global $wpdb; 4252 4251 … … 4279 4278 4280 4279 return " 4281 SELECT $meta_id_column 4282 FROM $table 4283 WHERE CASE meta_key 4280 AND CASE meta_key 4284 4281 " . implode( "\n", $clauses ) . " 4285 4282 END -
trunk/wp-includes/user.php
r15574 r15579 464 464 $meta_queries[] = wp_array_slice_assoc( $qv, array( 'meta_key', 'meta_value', 'meta_compare' ) ); 465 465 466 $meta_query_sql = _wp_meta_sql( $meta_queries, 'user_id' , $wpdb->usermeta);466 $meta_query_sql = _wp_meta_sql( $meta_queries, 'user_id' ); 467 467 468 468 if ( !empty( $meta_query_sql ) ) { 469 $this->query_where .= " AND $wpdb->users.ID IN ($meta_query_sql)"; 469 $this->query_from .= " INNER JOIN $wpdb->usermeta ON ($wpdb->users.ID = $wpdb->usermeta.user_id)"; 470 $this->query_where .= $meta_query_sql; 470 471 } 471 472 … … 491 492 global $wpdb; 492 493 493 $this->results = $wpdb->get_col("SELECT DISTINCT($wpdb->users.ID)" . $this->query_from . $this->query_where . $this->query_orderby . $this->query_limit);494 $this->results = $wpdb->get_col("SELECT $wpdb->users.ID" . $this->query_from . $this->query_where . $this->query_orderby . $this->query_limit); 494 495 495 496 if ( !$this->results ) … … 497 498 498 499 if ( $this->query_vars['count_total'] ) 499 $this->total_users = $wpdb->get_var("SELECT COUNT( DISTINCT($wpdb->users.ID))" . $this->query_from . $this->query_where);500 $this->total_users = $wpdb->get_var("SELECT COUNT($wpdb->users.ID)" . $this->query_from . $this->query_where); 500 501 501 502 if ( 'all' == $this->query_vars['fields'] ) {
Note: See TracChangeset
for help on using the changeset viewer.