WordPress.org

Make WordPress Core


Ignore:
Timestamp:
04/20/2017 12:13:41 AM (3 years ago)
Author:
flixos90
Message:

Multisite: Add $network_id parameter to wp_update_network_user_counts().

Using the new parameter, it is now possible to update the user count on a network different from the current one. While the count itself is technically a global user count and not network-wide, it is stored on each individual network, and the new parameter provides more control about where to update the count.

Fixes #40349. See #38699.

File:
1 edited

Legend:

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

    r40484 r40485  
    23552355 *
    23562356 * @since 3.7.0
     2357 * @since 4.8.0 The $network_id parameter has been added.
    23572358 *
    23582359 * @global wpdb $wpdb WordPress database abstraction object.
    2359  */
    2360 function wp_update_network_user_counts() {
     2360 *
     2361 * @param int|null $network_id ID of the network. Default is the current network.
     2362 */
     2363function wp_update_network_user_counts( $network_id = null ) {
    23612364    global $wpdb;
    23622365
    23632366    $count = $wpdb->get_var( "SELECT COUNT(ID) as c FROM $wpdb->users WHERE spam = '0' AND deleted = '0'" );
    2364     update_site_option( 'user_count', $count );
     2367    update_network_option( $network_id, 'user_count', $count );
    23652368}
    23662369
Note: See TracChangeset for help on using the changeset viewer.