WordPress.org

Make WordPress Core

Ticket #12555: 12555.proper.diff

File 12555.proper.diff, 1.3 KB (added by miqrogroove, 8 years ago)

Reverts [13617]. Improves style.

  • wp-admin/users.php

     
    370370        $role = array_shift($roles);
    371371
    372372        $style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"';
    373         echo "\n\t", user_row($user_object, $style, $role, isset( $post_counts[ $userid ] ) ? $post_counts[ $userid ] : 0 );
     373        echo "\n\t", user_row( $user_object, $style, $role, $post_counts[ $userid ] );
    374374}
    375375?>
    376376</tbody>
  • wp-includes/user.php

     
    169169        global $wpdb;
    170170
    171171        $count = array();
    172         if ( ! count( $users ) )
     172        if ( ! is_array($users) || empty( $users ) )
    173173                return $count;
    174174
    175175        $userlist = implode( ',', $users );
     
    177177
    178178        $result = $wpdb->get_results( "SELECT post_author, COUNT(*) FROM $wpdb->posts $where AND post_author IN ($userlist) GROUP BY post_author", ARRAY_N );
    179179
    180         if ( ! $result )
    181                 return $count;
    182 
    183         foreach ( $result as $row ) {
     180        foreach ( $result as $row )
    184181                $count[ $row[0] ] = $row[1];
    185         }
    186182
    187         foreach ( $users as $id ) {
     183        foreach ( $users as $id )
    188184                if ( ! isset( $count[ $id ] ) )
    189185                        $count[ $id ] = 0;
    190         }
    191186
    192187        return $count;
    193188}