Make WordPress Core


Ignore:
Timestamp:
04/03/2017 11:31:33 PM (8 years ago)
Author:
flixos90
Message:

Multisite: Add $network_id parameter to get_user_count().

The get_user_count() function returns the number of active users on a network, which is stored in a user_count network option. Since get_network_option() supports retrieving options from other networks than the current one, get_user_count() can now make use of that feature.

Fixes #37866.

File:
1 edited

Legend:

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

    r40370 r40371  
    9797 *
    9898 * @since MU 2.7
    99  *
    100  * @return int
    101  */
    102 function get_user_count() {
    103     return get_site_option( 'user_count' );
     99 * @since 4.8.0 The $network_id parameter has been added.
     100 *
     101 * @param int|null $network_id ID of the network. Default is the current network.
     102 * @return int Number of active users on the network.
     103 */
     104function get_user_count( $network_id = null ) {
     105    return get_network_option( $network_id, 'user_count' );
    104106}
    105107
Note: See TracChangeset for help on using the changeset viewer.