mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-22 08:11:52 +01:00
Fix warning in users.php. Fixes #12555
git-svn-id: http://svn.automattic.com/wordpress/trunk@13617 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a9e3eb84e8
commit
9c3f4265ab
@ -370,7 +370,7 @@ foreach ( $wp_user_search->get_results() as $userid ) {
|
||||
$role = array_shift($roles);
|
||||
|
||||
$style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"';
|
||||
echo "\n\t", user_row($user_object, $style, $role, $post_counts[(string)$userid]);
|
||||
echo "\n\t", user_row($user_object, $style, $role, isset( $post_counts[ $userid ] ) ? $post_counts[ $userid ] : 0 );
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
|
@ -167,24 +167,26 @@ function count_user_posts($userid) {
|
||||
*/
|
||||
function count_many_users_posts($users) {
|
||||
global $wpdb;
|
||||
|
||||
if (0 == count($users))
|
||||
return array();
|
||||
|
||||
$userlist = implode(',', $users);
|
||||
$where = get_posts_by_author_sql('post');
|
||||
|
||||
$count = array();
|
||||
if ( ! count( $users ) )
|
||||
return $count;
|
||||
|
||||
$userlist = implode( ',', $users );
|
||||
$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 );
|
||||
|
||||
$count = array();
|
||||
foreach($result as $row) {
|
||||
$count[$row[0]] = $row[1];
|
||||
if ( ! $result )
|
||||
return $count;
|
||||
|
||||
foreach ( $result as $row ) {
|
||||
$count[ $row[0] ] = $row[1];
|
||||
}
|
||||
|
||||
foreach($users as $id) {
|
||||
$id = (string) $id;
|
||||
if (!isset($count[$id]))
|
||||
$count[$id] = 0;
|
||||
foreach ( $users as $id ) {
|
||||
if ( ! isset( $count[ $id ] ) )
|
||||
$count[ $id ] = 0;
|
||||
}
|
||||
|
||||
return $count;
|
||||
|
Loading…
Reference in New Issue
Block a user