$meta_query_clauses =
$this->meta_query->
get_clauses();
$_orderby = '';
if ( in_array( $orderby, array
( 'login', 'nicename', 'email', 'url', 'registered'
), true
) ) { $_orderby = 'user_' .
$orderby;
} elseif ( in_array( $orderby, array
( 'user_login', 'user_nicename', 'user_email', 'user_url', 'user_registered'
), true
) ) { $_orderby =
$orderby;
} elseif ( 'name' ===
$orderby || 'display_name' ===
$orderby ) { $_orderby = 'display_name';
} elseif ( 'post_count' ===
$orderby ) { // @todo Avoid the JOIN.
$where =
get_posts_by_author_sql( 'post'
);
$this->query_from .= " LEFT OUTER JOIN (
SELECT post_author, COUNT(*) as post_count
FROM
$wpdb->posts
$where
GROUP BY post_author
) p ON ({
$wpdb->users
}.ID = p.post_author)";
$_orderby = 'post_count';
} elseif ( 'ID' ===
$orderby || 'id' ===
$orderby ) { $_orderby = 'ID';
} elseif ( 'meta_value' ===
$orderby ||
$this->
get( 'meta_key'
) ===
$orderby ) { $_orderby = "
$wpdb->usermeta.meta_value";
}