Show latest x users with no paging if on a large network. see #15170

git-svn-id: https://develop.svn.wordpress.org/trunk@16160 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2010-11-03 13:34:04 +00:00
parent 3d4abac949
commit 0ffd5e3012
2 changed files with 15 additions and 6 deletions

View File

@ -38,6 +38,16 @@ class WP_MS_Users_List_Table extends WP_List_Table {
'blog_id' => 0
);
// If the network is large and a search is not being performed, show only the latest users with no paging in order
// to avoid expensive count queries.
if ( !$usersearch && ( get_blog_count() >= 10000 ) ) {
if ( !isset($_REQUEST['orderby']) )
$_GET['orderby'] = $_REQUEST['orderby'] = 'id';
if ( !isset($_REQUEST['order']) )
$_GET['order'] = $_REQUEST['order'] = 'DESC';
$args['count_total'] = false;
}
if ( isset( $_REQUEST['orderby'] ) )
$args['orderby'] = $_REQUEST['orderby'];

View File

@ -411,11 +411,9 @@ class WP_User_Query extends WP_Object_Query {
// sorting
if ( in_array( $qv['orderby'], array('email', 'url', 'registered') ) ) {
$orderby = 'user_' . $qv['orderby'];
}
elseif ( 'name' == $qv['orderby'] ) {
} elseif ( 'name' == $qv['orderby'] ) {
$orderby = 'display_name';
}
elseif ( 'post_count' == $qv['orderby'] ) {
} elseif ( 'post_count' == $qv['orderby'] ) {
$where = get_posts_by_author_sql('post');
$this->query_from .= " LEFT OUTER JOIN (
SELECT post_author, COUNT(*) as post_count
@ -425,8 +423,9 @@ class WP_User_Query extends WP_Object_Query {
) p ON ({$wpdb->users}.ID = p.post_author)
";
$orderby = 'post_count';
}
else {
} elseif ( 'id' == $qv['orderby'] ) {
$orderby = 'ID';
} else {
$orderby = 'user_login';
}