Make WordPress Core

Ticket #12555: 10607-and-12555.diff

File 10607-and-12555.diff, 2.5 KB (added by miqrogroove, 15 years ago)

Unified patch, if needed.

  • 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}
  • wp-includes/wp-db.php

     
    445445        var $dbuser;
    446446
    447447        /**
     448         * {@internal Missing Description}}
     449         *
     450         * @since unknown
     451         * @access public
     452         * @var unknown
     453         */
     454        var $func_call;
     455
     456        /**
    448457         * Connects to the database server and selects a database
    449458         *
    450459         * PHP4 compatibility layer for calling the PHP5 constructor.
     
    13871396                } elseif ( $output == ARRAY_A || $output == ARRAY_N ) {
    13881397                        // Return an integer-keyed array of...
    13891398                        if ( $this->last_result ) {
    1390                                 $i = 0;
    13911399                                foreach( (array) $this->last_result as $row ) {
    13921400                                        if ( $output == ARRAY_N ) {
    13931401                                                // ...integer-keyed row arrays
    1394                                                 $new_array[$i] = array_values( get_object_vars( $row ) );
     1402                                                $new_array[] = array_values( get_object_vars( $row ) );
    13951403                                        } else {
    13961404                                                // ...column name-keyed row arrays
    1397                                                 $new_array[$i] = get_object_vars( $row );
     1405                                                $new_array[] = get_object_vars( $row );
    13981406                                        }
    1399                                         ++$i;
    14001407                                }
    1401                                 return $new_array;
    14021408                        }
     1409                        return $new_array;
    14031410                }
     1411                return null;
    14041412        }
    14051413
    14061414        /**