Ticket #8012: 8012.2.diff
File 8012.2.diff, 3.3 KB (added by , 5 years ago) |
---|
-
src/bp-core/bp-core-functions.php
diff --git src/bp-core/bp-core-functions.php src/bp-core/bp-core-functions.php index 09e5c3ee0..0dbbb7e6f 100644
function bp_get_allowedtags() { 3900 3900 function bp_strip_script_and_style_tags( $string ) { 3901 3901 return preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $string ); 3902 3902 } 3903 3904 /** 3905 * Check if this is a large network or single site. 3906 * This is a single-site-safe wrapper for the WordPress function that is only available in multisite. 3907 * 3908 * The default criteria for a large network is either more than 10,000 users or more than 10,000 sites. 3909 * 3910 * @since 4.1.0 3911 * 3912 * @param string $using 'sites or 'users'. Default is 'sites'. 3913 * @param int|null $network_id ID of the network. Default is the current network. 3914 * @return bool True if the network meets the criteria for large. False otherwise. 3915 */ 3916 function bp_is_large_network( $using = 'sites', $network_id = null ) { 3917 // Fall back to the WordPress native function if available. 3918 if ( is_multisite() ) { 3919 return wp_is_large_network( $using, $network_id ); 3920 } 3921 3922 if ( 'users' === $using ) { 3923 $count = bp_core_get_total_member_count(); 3924 /** 3925 * Filters whether the BuddyPress site is considered large. 3926 * 3927 * @since 4.1.0 3928 * 3929 * @param bool $is_large_network Whether the network has more than 10000 users or sites. 3930 * @param string $component The component to count. Accepts 'users' or 'sites'. 3931 * @param int $count The count of items for the component. 3932 */ 3933 return apply_filters( 'bp_is_large_network', $count > 10000, 'users', $count ); 3934 } 3935 3936 // Else, we're counting sites, and non-multisite means there's only one. 3937 /** This filter is documented in bp-core/bp-core-functions.php */ 3938 return apply_filters( 'bp_is_large_network', false, 'sites', 1 ); 3939 } -
src/bp-friends/bp-friends-functions.php
diff --git src/bp-friends/bp-friends-functions.php src/bp-friends/bp-friends-functions.php index 2b446e28d..822b6596b 100644
function bp_friends_prime_mentions_results() { 781 781 } 782 782 783 783 // Bail out if the site has a ton of users. 784 if ( is_multisite() && wp_is_large_network( 'users' ) ) {784 if ( bp_is_large_network( 'users' ) ) { 785 785 return; 786 786 } 787 787 -
src/bp-groups/bp-groups-admin.php
diff --git src/bp-groups/bp-groups-admin.php src/bp-groups/bp-groups-admin.php index 353b6ead2..51278892c 100644
function bp_groups_admin_edit_metabox_settings( $item ) { 861 861 * @param BP_Groups_Group $item The BP_Groups_Group object for the current group. 862 862 */ 863 863 function bp_groups_admin_edit_metabox_add_new_members( $item ) { 864 if ( wp_is_large_network( 'users' ) ) {864 if ( bp_is_large_network( 'users' ) ) { 865 865 $class = ''; 866 866 $notice = __( 'Enter a comma-separated list of user logins.', 'buddypress' ); 867 867 } else { … … function bp_groups_admin_get_usernames_from_ids( $user_ids = array() ) { 1252 1252 function bp_groups_admin_autocomplete_handler() { 1253 1253 1254 1254 // Bail if user user shouldn't be here, or is a large network. 1255 if ( ! bp_current_user_can( 'bp_moderate' ) || ( is_multisite() && wp_is_large_network( 'users' )) ) {1255 if ( ! bp_current_user_can( 'bp_moderate' ) || bp_is_large_network( 'users' ) ) { 1256 1256 wp_die( -1 ); 1257 1257 } 1258 1258