Make WordPress Core


Ignore:
Timestamp:
01/30/2025 11:20:58 AM (6 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict comparison in wp_xmlrpc_server::wp_getUsersBlogs().

Includes a micro-optimization to avoid calling get_current_network_id() in a loop.

Follow-up to [8075], [9798], [26120], [38814].

Props aristath, poena, afercia, SergeyBiryukov.
See #62279.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-functions.php

    r59574 r59738  
    7777        $blogs = get_blogs_of_user( $user_id, true ); // If a user's primary blog is shut down, check their other blogs.
    7878        $ret   = false;
     79
    7980        if ( is_array( $blogs ) && count( $blogs ) > 0 ) {
     81            $current_network_id = get_current_network_id();
     82
    8083            foreach ( (array) $blogs as $blog_id => $blog ) {
    81                 if ( get_current_network_id() !== $blog->site_id ) {
     84                if ( $blog->site_id !== $current_network_id ) {
    8285                    continue;
    8386                }
     
    100103            return;
    101104        }
     105
    102106        return $ret;
    103107    } else {
Note: See TracChangeset for help on using the changeset viewer.