Ticket #20601: 20601.8.diff
File 20601.8.diff, 2.4 KB (added by , 11 years ago) |
---|
-
src/wp-includes/class-wp.php
class WP { 568 568 // We will 404 for paged queries, as no posts were found. 569 569 if ( ! is_paged() ) { 570 570 571 // Don't 404 for authors without posts as long as they matched an author on this site. 572 $author = get_query_var( 'author' ); 573 if ( is_author() && is_numeric( $author ) && $author > 0 && is_user_member_of_blog( $author ) ) { 574 status_header( 200 ); 575 return; 576 } 577 571 578 // Don't 404 for these queries if they matched an object. 572 if ( ( is_tag() || is_category() || is_tax() || is_ author() || is_post_type_archive() ) && $wp_query->get_queried_object() ) {579 if ( ( is_tag() || is_category() || is_tax() || is_post_type_archive() ) && get_queried_object() ) { 573 580 status_header( 200 ); 574 581 return; 575 582 } -
tests/phpunit/tests/ms.php
class Tests_MS extends WP_UnitTestCase { 1219 1219 $this->assertEquals( $ids['wordpress.net/'], 1220 1220 get_network_by_path( 'site1.wordpress.net', '/three/' )->id ); 1221 1221 } 1222 1223 /** 1224 * @ticket 20601 1225 */ 1226 function test_user_member_of_blog() { 1227 $this->factory->blog->create(); 1228 $user_id = $this->factory->user->create(); 1229 $this->factory->blog->create( array( 'user_id' => $user_id ) ); 1230 1231 $blogs = get_blogs_of_user( $user_id ); 1232 $this->assertCount( 2, $blogs ); 1233 $first = reset( $blogs )->userblog_id; 1234 remove_user_from_blog( $user_id, $first ); 1235 1236 $blogs = get_blogs_of_user( $user_id ); 1237 $second = reset( $blogs )->userblog_id; 1238 $this->assertCount( 1, $blogs ); 1239 1240 switch_to_blog( $first ); 1241 1242 $this->go_to( get_author_posts_url( $user_id ) ); 1243 $this->assertQueryTrue( 'is_404' ); 1244 1245 switch_to_blog( $second ); 1246 1247 $this->go_to( get_author_posts_url( $user_id ) ); 1248 $this->assertQueryTrue( 'is_author', 'is_archive' ); 1249 1250 add_user_to_blog( $first, $user_id, 'administrator' ); 1251 $blogs = get_blogs_of_user( $user_id ); 1252 $this->assertCount( 2, $blogs ); 1253 1254 switch_to_blog( $first ); 1255 1256 $this->go_to( get_author_posts_url( $user_id ) ); 1257 $this->assertQueryTrue( 'is_author', 'is_archive' ); 1258 } 1222 1259 } 1223 1260 1224 1261 endif;