Skip to content

Commit 27bb7ac

Browse files
Coding Standards: Use strict comparison in remove_user_from_blog().
Follow-up to [https://mu.trac.wordpress.org/changeset/543 mu:543]. Props debarghyabanerjee, aristath, poena, afercia, SergeyBiryukov. See #62279, #62283. git-svn-id: https://develop.svn.wordpress.org/trunk@59561 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 87f99b4 commit 27bb7ac

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/wp-includes/ms-functions.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,10 @@ function add_user_to_blog( $blog_id, $user_id, $role ) {
230230
function remove_user_from_blog( $user_id, $blog_id = 0, $reassign = 0 ) {
231231
global $wpdb;
232232

233-
switch_to_blog( $blog_id );
234233
$user_id = (int) $user_id;
234+
$blog_id = (int) $blog_id;
235+
236+
switch_to_blog( $blog_id );
235237

236238
/**
237239
* Fires before a user is removed from a site.
@@ -249,13 +251,13 @@ function remove_user_from_blog( $user_id, $blog_id = 0, $reassign = 0 ) {
249251
* If being removed from the primary blog, set a new primary
250252
* if the user is assigned to multiple blogs.
251253
*/
252-
$primary_blog = get_user_meta( $user_id, 'primary_blog', true );
253-
if ( $primary_blog == $blog_id ) {
254+
$primary_blog = (int) get_user_meta( $user_id, 'primary_blog', true );
255+
if ( $primary_blog === $blog_id ) {
254256
$new_id = '';
255257
$new_domain = '';
256258
$blogs = get_blogs_of_user( $user_id );
257259
foreach ( (array) $blogs as $blog ) {
258-
if ( $blog->userblog_id == $blog_id ) {
260+
if ( $blog->userblog_id === $blog_id ) {
259261
continue;
260262
}
261263
$new_id = $blog->userblog_id;

0 commit comments

Comments
 (0)