From 58b810e9eb6770f05395a68eac7f97edeea7acb4 Mon Sep 17 00:00:00 2001 From: Felix Arntz Date: Wed, 5 Apr 2017 02:18:00 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@40371 git-svn-id: http://core.svn.wordpress.org/trunk@40278 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/ms-functions.php | 8 +++++--- wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/wp-includes/ms-functions.php b/wp-includes/ms-functions.php index d1536eb030..a562cdf241 100644 --- a/wp-includes/ms-functions.php +++ b/wp-includes/ms-functions.php @@ -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' ); } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index 83a68fea49..c50f431d5d 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.8-alpha-40370'; +$wp_version = '4.8-alpha-40371'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.