Fix notice on users admin panel. More or less reverts earlier fix, [13617]. props miqrogroove. fixes #12555

git-svn-id: http://svn.automattic.com/wordpress/trunk@13680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-03-12 00:03:44 +00:00
parent 1cb0f9042b
commit 03eac5614c
2 changed files with 2 additions and 6 deletions

View File

@ -370,7 +370,7 @@ foreach ( $wp_user_search->get_results() as $userid ) {
$role = array_shift($roles); $role = array_shift($roles);
$style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"'; $style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"';
echo "\n\t", user_row($user_object, $style, $role, isset( $post_counts[ $userid ] ) ? $post_counts[ $userid ] : 0 ); echo "\n\t", user_row( $user_object, $style, $role, $post_counts[ $userid ] );
} }
?> ?>
</tbody> </tbody>

View File

@ -169,17 +169,13 @@ function count_many_users_posts($users) {
global $wpdb; global $wpdb;
$count = array(); $count = array();
if ( ! count( $users ) ) if ( ! is_array($users) || empty( $users ) )
return $count; return $count;
$userlist = implode( ',', $users ); $userlist = implode( ',', $users );
$where = get_posts_by_author_sql( 'post' ); $where = get_posts_by_author_sql( 'post' );
$result = $wpdb->get_results( "SELECT post_author, COUNT(*) FROM $wpdb->posts $where AND post_author IN ($userlist) GROUP BY post_author", ARRAY_N ); $result = $wpdb->get_results( "SELECT post_author, COUNT(*) FROM $wpdb->posts $where AND post_author IN ($userlist) GROUP BY post_author", ARRAY_N );
if ( ! $result )
return $count;
foreach ( $result as $row ) { foreach ( $result as $row ) {
$count[ $row[0] ] = $row[1]; $count[ $row[0] ] = $row[1];
} }