Changeset 13617
- Timestamp:
- 03/08/2010 02:30:17 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/users.php
r13576 r13617 371 371 372 372 $style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"'; 373 echo "\n\t", user_row($user_object, $style, $role, $post_counts[(string)$userid]);373 echo "\n\t", user_row($user_object, $style, $role, isset( $post_counts[ $userid ] ) ? $post_counts[ $userid ] : 0 ); 374 374 } 375 375 ?> -
trunk/wp-includes/user.php
r13576 r13617 168 168 function count_many_users_posts($users) { 169 169 global $wpdb; 170 171 if (0 == count($users)) 172 return array(); 173 174 $userlist = implode(',', $users); 175 $where = get_posts_by_author_sql('post'); 170 171 $count = array(); 172 if ( ! count( $users ) ) 173 return $count; 174 175 $userlist = implode( ',', $users ); 176 $where = get_posts_by_author_sql( 'post' ); 176 177 177 178 $result = $wpdb->get_results( "SELECT post_author, COUNT(*) FROM $wpdb->posts $where AND post_author IN ($userlist) GROUP BY post_author", ARRAY_N ); 178 179 179 $count = array(); 180 foreach($result as $row) { 181 $count[$row[0]] = $row[1]; 182 } 183 184 foreach($users as $id) { 185 $id = (string) $id; 186 if (!isset($count[$id])) 187 $count[$id] = 0; 180 if ( ! $result ) 181 return $count; 182 183 foreach ( $result as $row ) { 184 $count[ $row[0] ] = $row[1]; 185 } 186 187 foreach ( $users as $id ) { 188 if ( ! isset( $count[ $id ] ) ) 189 $count[ $id ] = 0; 188 190 } 189 191
Note: See TracChangeset
for help on using the changeset viewer.