[wp-trac] [WordPress Trac] #61019: Request to Enable Bulk Copy of Post URLs from WordPress Dashboard
WordPress Trac
noreply at wordpress.org
Thu Apr 18 18:27:26 UTC 2024
#61019: Request to Enable Bulk Copy of Post URLs from WordPress Dashboard
-----------------------------+------------------------------
Reporter: jacobpine88 | Owner: (none)
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 6.5
Severity: trivial | Resolution:
Keywords: | Focuses:
-----------------------------+------------------------------
Comment (by jacobpine88):
The bbp_get_total_users() function is part of the BuddyPress Forums
(bbPress) plugin and is used to retrieve the total number of registered
users in the forum.
In a WordPress Multisite setup, the issue with this function is that it
only retrieves the total number of users for the current site, rather than
the total across the entire Multisite network.
To address this, you can use the get_user_count() function instead, which
will return the total number of users across the entire Multisite network.
Here's an example of how you can use the get_user_count() function to get
the total number of users in a Multisite environment:
php
function bbp_get_total_users_multisite() {
if ( is_multisite() ) {
return get_user_count();
} else {
return bbp_get_total_users();
}
}
In this function, we first check if the site is a Multisite installation
using the is_multisite() function. If it is, we use the get_user_count()
function to retrieve the total number of users across the entire network.
If it's not a Multisite setup, we use the original bbp_get_total_users()
function.
You can then use this new bbp_get_total_users_multisite() function
wherever you need to display the total number of users in your BuddyPress
Forums (bbPress) plugin.
Keep in mind that the get_user_count() function may be slower than the
bbp_get_total_users() function, as it needs to query the entire Multisite
network to retrieve the user count. If performance is a concern, you may
want to consider caching the result of the bbp_get_total_users_multisite()
function.
{{{
#!html
--
Ticket URL: <https://core.trac.wordpress.org/ticket/61019#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list