Skip to main content
Updated answer with answer to additional question in the comments
Source Link
Pat J
  • 12.3k
  • 2
  • 28
  • 36

Yes, all the WordPress Multisite users go into the {$wpdb->prefix}users table; that way they form a pool of users that can each be given access to one or more sites in your network.

You can get the users for a given site by using get_users(), which can take as an argument the ID of a given site:

// get users for site example.com/my-site
$args = array(
    'blog_id' = get_id_from_blogname( 'my-site' ),
);
$users_for_site = get_users( $args );

If you're using Multisite, and the blog_id argument isn't set, you'll get the users for the current site.

Comparing email addresses

By default, get_users() returns an array of WP_User objects, so you should be able to compare your list of email addresses (assumed to be contained in the array $my_user_emails in the code below) to the list of addresses returned by get_users():

// uses $users_for_site from the previous code block

$no_email_entered = array();
foreach( $users_for_site as $user ) {
    if( ! in_array( $user->user_email, $my_user_emails ) ) {
        $no_email_entered[] = $user->user_email;
    }
}
// $no_email_entered should now contain all the email addresses 
// in the list of site users that are *not* in your table

References

Yes, all the WordPress Multisite users go into the {$wpdb->prefix}users table; that way they form a pool of users that can each be given access to one or more sites in your network.

You can get the users for a given site by using get_users(), which can take as an argument the ID of a given site:

// get users for site example.com/my-site
$args = array(
    'blog_id' = get_id_from_blogname( 'my-site' ),
);
$users_for_site = get_users( $args );

If you're using Multisite, and the blog_id argument isn't set, you'll get the users for the current site.

References

Yes, all the WordPress Multisite users go into the {$wpdb->prefix}users table; that way they form a pool of users that can each be given access to one or more sites in your network.

You can get the users for a given site by using get_users(), which can take as an argument the ID of a given site:

// get users for site example.com/my-site
$args = array(
    'blog_id' = get_id_from_blogname( 'my-site' ),
);
$users_for_site = get_users( $args );

If you're using Multisite, and the blog_id argument isn't set, you'll get the users for the current site.

Comparing email addresses

By default, get_users() returns an array of WP_User objects, so you should be able to compare your list of email addresses (assumed to be contained in the array $my_user_emails in the code below) to the list of addresses returned by get_users():

// uses $users_for_site from the previous code block

$no_email_entered = array();
foreach( $users_for_site as $user ) {
    if( ! in_array( $user->user_email, $my_user_emails ) ) {
        $no_email_entered[] = $user->user_email;
    }
}
// $no_email_entered should now contain all the email addresses 
// in the list of site users that are *not* in your table

References

typo fix
Source Link
Pat J
  • 12.3k
  • 2
  • 28
  • 36

Yes, all the WordPress Multisite users go into the {$wpdb->prefix}wp_usersusers table; that way they form a pool of users that can each be given access to one or more sites in your network.

You can get the users for a given site by using get_users(), which can take as an argument the ID of a given site:

// get users for site example.com/my-site
$args = array(
    'blog_id' = get_id_from_blogname( 'my-site' ),
);
$users_for_site = get_users( $args );

If you're using Multisite, and the blog_id argument isn't set, you'll get the users for the current site.

References

Yes, all the WordPress Multisite users go into the {$wpdb->prefix}wp_users table; that way they form a pool of users that can each be given access to one or more sites in your network.

You can get the users for a given site by using get_users(), which can take as an argument the ID of a given site:

// get users for site example.com/my-site
$args = array(
    'blog_id' = get_id_from_blogname( 'my-site' ),
);
$users_for_site = get_users( $args );

If you're using Multisite, and the blog_id argument isn't set, you'll get the users for the current site.

References

Yes, all the WordPress Multisite users go into the {$wpdb->prefix}users table; that way they form a pool of users that can each be given access to one or more sites in your network.

You can get the users for a given site by using get_users(), which can take as an argument the ID of a given site:

// get users for site example.com/my-site
$args = array(
    'blog_id' = get_id_from_blogname( 'my-site' ),
);
$users_for_site = get_users( $args );

If you're using Multisite, and the blog_id argument isn't set, you'll get the users for the current site.

References

Source Link
Pat J
  • 12.3k
  • 2
  • 28
  • 36

Yes, all the WordPress Multisite users go into the {$wpdb->prefix}wp_users table; that way they form a pool of users that can each be given access to one or more sites in your network.

You can get the users for a given site by using get_users(), which can take as an argument the ID of a given site:

// get users for site example.com/my-site
$args = array(
    'blog_id' = get_id_from_blogname( 'my-site' ),
);
$users_for_site = get_users( $args );

If you're using Multisite, and the blog_id argument isn't set, you'll get the users for the current site.

References