Skip to content

Commit

Permalink
Coding Standards: Use strict comparison in remove_user_from_blog().
Browse files Browse the repository at this point in the history
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
  • Loading branch information
SergeyBiryukov committed Dec 25, 2024
1 parent 87f99b4 commit 27bb7ac
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/wp-includes/ms-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,10 @@ function add_user_to_blog( $blog_id, $user_id, $role ) {
function remove_user_from_blog( $user_id, $blog_id = 0, $reassign = 0 ) {
global $wpdb;

switch_to_blog( $blog_id );
$user_id = (int) $user_id;
$blog_id = (int) $blog_id;

switch_to_blog( $blog_id );

/**
* Fires before a user is removed from a site.
Expand All @@ -249,13 +251,13 @@ function remove_user_from_blog( $user_id, $blog_id = 0, $reassign = 0 ) {
* If being removed from the primary blog, set a new primary
* if the user is assigned to multiple blogs.
*/
$primary_blog = get_user_meta( $user_id, 'primary_blog', true );
if ( $primary_blog == $blog_id ) {
$primary_blog = (int) get_user_meta( $user_id, 'primary_blog', true );
if ( $primary_blog === $blog_id ) {
$new_id = '';
$new_domain = '';
$blogs = get_blogs_of_user( $user_id );
foreach ( (array) $blogs as $blog ) {
if ( $blog->userblog_id == $blog_id ) {
if ( $blog->userblog_id === $blog_id ) {
continue;
}
$new_id = $blog->userblog_id;
Expand Down

0 comments on commit 27bb7ac

Please sign in to comment.