Ticket #17582: 17582.4.diff
File 17582.4.diff, 1.5 KB (added by , 14 years ago) |
---|
-
wp-includes/user.php
383 383 'search' => '', 384 384 'orderby' => 'login', 385 385 'order' => 'ASC', 386 'offset' => '', 'number' => '', 386 'offset' => '', 387 'number' => '', 387 388 'count_total' => true, 388 389 'fields' => 'all', 389 390 'who' => '' … … 418 419 $this->query_fields = "$wpdb->users.ID"; 419 420 } 420 421 422 if ( $this->query_vars['count_total'] ) { 423 $this->query_fields = 'SQL_CALC_FOUND_ROWS ' . $this->query_fields; 424 } 425 421 426 $this->query_from = "FROM $wpdb->users"; 422 427 $this->query_where = "WHERE 1=1"; 423 428 … … 517 522 $clauses = $meta_query->get_sql( 'user', $wpdb->users, 'ID', $this ); 518 523 $this->query_from .= $clauses['join']; 519 524 $this->query_where .= $clauses['where']; 525 526 if ( 'OR' == $meta_query->relation ) { 527 $this->query_fields = 'DISTINCT ' . $this->query_fields; 528 } 520 529 } 521 530 522 531 if ( !empty( $qv['include'] ) ) { … … 545 554 $this->results = $wpdb->get_col("SELECT $this->query_fields $this->query_from $this->query_where $this->query_orderby $this->query_limit"); 546 555 } 547 556 548 if ( $this->query_vars['count_total'] ) 549 $this->total_users = $wpdb->get_var("SELECT COUNT(*) $this->query_from $this->query_where"); 557 if ( $this->query_vars['count_total'] ) { 558 $this->total_users = $wpdb->get_var( apply_filters( 'found_users_query', 'SELECT FOUND_ROWS()' ) ); 559 } 550 560 551 561 if ( !$this->results ) 552 562 return;