mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-04 14:47:02 +00:00
Multisite: Use get_current_blog_id() instead of $wpdb->blogid.
`get_current_blog_id()` is more appropriate for determining the ID of the current site in most cases. This eliminates the need for the global `$wpdb` in several functions and is better than the implicit global used in admin pages. Props bnap00, spacedmonkey. Fixes #41684. git-svn-id: https://develop.svn.wordpress.org/trunk@41661 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -120,7 +120,7 @@ class Tests_Multisite_User extends WP_UnitTestCase {
|
||||
wp_set_current_user( $user1_id );
|
||||
|
||||
$this->assertTrue( is_blog_user() );
|
||||
$this->assertTrue( is_blog_user( $wpdb->blogid ) );
|
||||
$this->assertTrue( is_blog_user( get_current_blog_id() ) );
|
||||
|
||||
$blog_ids = array();
|
||||
|
||||
@@ -149,12 +149,13 @@ class Tests_Multisite_User extends WP_UnitTestCase {
|
||||
$this->assertFalse( is_user_member_of_blog() );
|
||||
|
||||
wp_set_current_user( $user1_id );
|
||||
$site_id = get_current_blog_id();
|
||||
|
||||
$this->assertTrue( is_user_member_of_blog() );
|
||||
$this->assertTrue( is_user_member_of_blog( 0, 0 ) );
|
||||
$this->assertTrue( is_user_member_of_blog( 0, $wpdb->blogid ) );
|
||||
$this->assertTrue( is_user_member_of_blog( 0, $site_id ) );
|
||||
$this->assertTrue( is_user_member_of_blog( $user1_id ) );
|
||||
$this->assertTrue( is_user_member_of_blog( $user1_id, $wpdb->blogid ) );
|
||||
$this->assertTrue( is_user_member_of_blog( $user1_id, $site_id ) );
|
||||
|
||||
$blog_ids = self::factory()->blog->create_many( 1 );
|
||||
foreach ( $blog_ids as $blog_id ) {
|
||||
|
||||
Reference in New Issue
Block a user