Ticket #23498: 23498.2.diff
File 23498.2.diff, 1.9 KB (added by , 10 years ago) |
---|
-
src/wp-includes/author-template.php
334 334 335 335 $query_args = wp_array_slice_assoc( $args, array( 'orderby', 'order', 'number', 'exclude', 'include' ) ); 336 336 $query_args['fields'] = 'ids'; 337 338 if( $args['exclude_admin'] == true ) { 339 $exclude = get_users( array( 'role' => 'administrator' ) ); 340 foreach ( $exclude as $admin ) { 341 $exclude_ids[] = $admin->ID; 342 } 343 $query_args['exclude'] = $exclude_ids; 344 } 345 337 346 $authors = get_users( $query_args ); 338 347 339 348 $author_count = array(); … … 343 352 foreach ( $authors as $author_id ) { 344 353 $author = get_userdata( $author_id ); 345 354 346 if ( $args['exclude_admin'] && 'admin' == $author->display_name ) { 347 continue; 348 } 355 $posts = isset( $author_count[ $author->ID ] ) ? $author_count[ $author->ID ] : 0; 349 356 350 $posts = isset( $author_count[$author->ID] ) ? $author_count[$author->ID] : 0;351 352 357 if ( ! $posts && $args['hide_empty'] ) { 353 358 continue; 354 359 } -
tests/phpunit/tests/user/listAuthors.php
119 119 $this->AssertEquals( $expected['html'], wp_list_authors( array( 'echo' => false, 'html' => 0 ) ) ); 120 120 } 121 121 122 /** 123 * @ticket 23498 124 */ 125 function test_wp_list_authors_number() { 126 $expected['number'] = '<li><a href="http://example.org/?author=' . $this->users[1] . '" title="Posts by bob">bob</a></li><li><a href="http://example.org/?author=' . $this->users[2] . '" title="Posts by paul">paul</a></li>'; 127 $this->AssertEquals( $expected['number'], wp_list_authors( array( 'echo' => false, 'number' => 2 ) ) ); 128 } 129 122 130 }