Make WP_User_Query return regular objects by default. Fixes #15854
git-svn-id: https://develop.svn.wordpress.org/trunk@17013 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
48141dcc84
commit
e452616f40
@ -27,7 +27,8 @@ class WP_MS_Users_List_Table extends WP_List_Table {
|
||||
'number' => $users_per_page,
|
||||
'offset' => ( $paged-1 ) * $users_per_page,
|
||||
'search' => $usersearch,
|
||||
'blog_id' => 0
|
||||
'blog_id' => 0,
|
||||
'fields' => 'all_with_meta'
|
||||
);
|
||||
|
||||
if ( $role == 'super' ) {
|
||||
|
@ -47,7 +47,8 @@ class WP_Users_List_Table extends WP_List_Table {
|
||||
'number' => $users_per_page,
|
||||
'offset' => ( $paged-1 ) * $users_per_page,
|
||||
'role' => $role,
|
||||
'search' => $usersearch
|
||||
'search' => $usersearch,
|
||||
'fields' => 'all_with_meta'
|
||||
);
|
||||
|
||||
if ( $this->is_site_users )
|
||||
|
@ -414,6 +414,8 @@ class WP_User_Query {
|
||||
foreach ( $qv['fields'] as $field )
|
||||
$this->query_fields[] = $wpdb->users . '.' . esc_sql( $field );
|
||||
$this->query_fields = implode( ',', $this->query_fields );
|
||||
} elseif ( 'all' == $qv['fields'] ) {
|
||||
$this->query_fields = "$wpdb->users.*";
|
||||
} else {
|
||||
$this->query_fields = "$wpdb->users.ID";
|
||||
}
|
||||
@ -522,7 +524,7 @@ class WP_User_Query {
|
||||
function query() {
|
||||
global $wpdb;
|
||||
|
||||
if ( is_array( $this->query_vars['fields'] ) ) {
|
||||
if ( is_array( $this->query_vars['fields'] ) || 'all' == $this->query_vars['fields'] ) {
|
||||
$this->results = $wpdb->get_results("SELECT $this->query_fields $this->query_from $this->query_where $this->query_orderby $this->query_limit");
|
||||
} else {
|
||||
$this->results = $wpdb->get_col("SELECT $this->query_fields $this->query_from $this->query_where $this->query_orderby $this->query_limit");
|
||||
@ -534,8 +536,8 @@ class WP_User_Query {
|
||||
if ( $this->query_vars['count_total'] )
|
||||
$this->total_users = $wpdb->get_var("SELECT COUNT($wpdb->users.ID) $this->query_from $this->query_where $this->query_orderby $this->query_limit");
|
||||
|
||||
if ( 'all' == $this->query_vars['fields'] ) {
|
||||
cache_users($this->results);
|
||||
if ( 'all_with_meta' == $this->query_vars['fields'] ) {
|
||||
cache_users( $this->results );
|
||||
|
||||
$r = array();
|
||||
foreach ( $this->results as $userid )
|
||||
|
Loading…
Reference in New Issue
Block a user