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.


git-svn-id: https://develop.svn.wordpress.org/trunk@40371 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
flixos90
2017-04-03 23:31:33 +00:00
parent 117f2da3cc
commit 707bf79a9b
2 changed files with 34 additions and 3 deletions

View File

@@ -96,11 +96,13 @@ function get_active_blog_for_user( $user_id ) {
* The count is cached and updated twice daily. This is not a live count.
*
* @since MU 2.7
* @since 4.8.0 The $network_id parameter has been added.
*
* @return int
* @param int|null $network_id ID of the network. Default is the current network.
* @return int Number of active users on the network.
*/
function get_user_count() {
return get_site_option( 'user_count' );
function get_user_count( $network_id = null ) {
return get_network_option( $network_id, 'user_count' );
}
/**