Ticket #23498: 23498.3.diff
File 23498.3.diff, 1.9 KB (added by , 9 years ago) |
---|
-
src/wp-includes/author-template.php
355 355 356 356 $query_args = wp_array_slice_assoc( $args, array( 'orderby', 'order', 'number', 'exclude', 'include' ) ); 357 357 $query_args['fields'] = 'ids'; 358 359 if( true == $args['exclude_admin'] ) { 360 $exclude = get_users( array( 'role' => 'administrator' ) ); 361 foreach ( $exclude as $admin ) { 362 $exclude_ids[] = $admin->ID; 363 } 364 $query_args['exclude'] = $exclude_ids; 365 } 366 358 367 $authors = get_users( $query_args ); 359 368 360 369 $author_count = array(); … … 364 373 foreach ( $authors as $author_id ) { 365 374 $author = get_userdata( $author_id ); 366 375 367 if ( $args['exclude_admin'] && 'admin' == $author->display_name ) { 368 continue; 369 } 376 $posts = isset( $author_count[ $author->ID ] ) ? $author_count[ $author->ID ] : 0; 370 377 371 $posts = isset( $author_count[$author->ID] ) ? $author_count[$author->ID] : 0;372 373 378 if ( ! $posts && $args['hide_empty'] ) { 374 379 continue; 375 380 } -
tests/phpunit/tests/user/listAuthors.php
141 141 $expected['html'] = 'bob, paul, zack'; 142 142 $this->AssertEquals( $expected['html'], wp_list_authors( array( 'echo' => false, 'html' => 0 ) ) ); 143 143 } 144 145 /** 146 * @ticket 23498 147 */ 148 function test_wp_list_authors_number() { 149 $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>'; 150 $this->AssertEquals( $expected['number'], wp_list_authors( array( 'echo' => false, 'number' => 2 ) ) ); 151 } 144 152 }