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

git-svn-id: http://svn.automattic.com/wordpress/trunk@16160 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-11-03 13:34:04 +00:00
parent 606ae7ee4d
commit f5ab587c9d
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';
}