diff --git a/wp-admin/includes/schema.php b/wp-admin/includes/schema.php index c1392259d..ac720705a 100644 --- a/wp-admin/includes/schema.php +++ b/wp-admin/includes/schema.php @@ -146,7 +146,8 @@ CREATE TABLE $wpdb->posts ( PRIMARY KEY (ID), KEY post_name (post_name), KEY type_status_date (post_type,post_status,post_date,ID), - KEY post_parent (post_parent) + KEY post_parent (post_parent), + KEY post_author (post_author) ) $charset_collate; CREATE TABLE $wpdb->users ( ID bigint(20) unsigned NOT NULL auto_increment, diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 0211822a1..4b215128b 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -1824,16 +1824,17 @@ function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_ } /** - * {@internal Missing Short Description}} + * Generate HTML for a single row on the users.php admin panel. * - * @since unknown + * @since 2.1.0 * - * @param unknown_type $user_object - * @param unknown_type $style - * @param unknown_type $role - * @return unknown + * @param object $user_object + * @param string $style Optional. Attributes added to the TR element. Must be sanitized. + * @param string $role Key for the $wp_roles array. + * @param int $numposts Optional. Post count to display for this user. Defaults to zero, as in, a new user has made zero posts. + * @return string */ -function user_row( $user_object, $style = '', $role = '' ) { +function user_row( $user_object, $style = '', $role = '', $numposts = 0 ) { global $wp_roles; $current_user = wp_get_current_user(); @@ -1849,7 +1850,6 @@ function user_row( $user_object, $style = '', $role = '' ) { $short_url = substr( $short_url, 0, -1 ); if ( strlen( $short_url ) > 35 ) $short_url = substr( $short_url, 0, 32 ).'...'; - $numposts = get_usernumposts( $user_object->ID ); $checkbox = ''; // Check if the user for this row is editable if ( current_user_can( 'edit_user', $user_object->ID ) ) { diff --git a/wp-admin/users.php b/wp-admin/users.php index e68cb8f87..39c077efa 100644 --- a/wp-admin/users.php +++ b/wp-admin/users.php @@ -208,9 +208,15 @@ default: $userspage = isset($_GET['userspage']) ? $_GET['userspage'] : null; $role = isset($_GET['role']) ? $_GET['role'] : null; - // Query the users + // Query the user IDs for this page $wp_user_search = new WP_User_Search($usersearch, $userspage, $role); + // Query the post counts for this page + $post_counts = count_many_users_posts($wp_user_search->get_results()); + + // Query the users for this page + cache_users($wp_user_search->get_results()); + $messages = array(); if ( isset($_GET['update']) ) : switch($_GET['update']) { @@ -263,22 +269,14 @@ if ( isset($_GET['usersearch']) && $_GET['usersearch'] )