Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/03/2018 08:51:15 PM (3 years ago)
Author:
boonebgorges
Message:

Introduce bp_is_large_install() and use throughout BuddyPress.

This checks provides a fallback that is not dependent on Multisite, and
helps prevent a fatal error introduced in [12241]. See #7980.

Props shanebp, dcavins, johnjamesjacoby.
Fixes #8012.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-functions.php

    r12286 r12303  
    39013901    return preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $string );
    39023902}
     3903
     3904/**
     3905 * Checks whether the current installation is "large".
     3906 *
     3907 * By default, an installation counts as "large" if there are 10000 users or more.
     3908 * Filter 'bp_is_large_install' to adjust.
     3909 *
     3910 * @since 4.1.0
     3911 *
     3912 * @return bool
     3913 */
     3914function bp_is_large_install() {
     3915    // Use the Multisite function if available.
     3916    if ( function_exists( 'wp_is_large_network' ) ) {
     3917        $is_large = wp_is_large_network( 'users' );
     3918    } else {
     3919        $is_large = bp_core_get_total_member_count() > 10000;
     3920    }
     3921
     3922    /**
     3923     * Filters whether the current installation is "large".
     3924     *
     3925     * @since 4.1.0
     3926     *
     3927     * @param bool $is_large True if the network is "large".
     3928     */
     3929    return (bool) apply_filters( 'bp_is_large_install', $is_large );
     3930}
Note: See TracChangeset for help on using the changeset viewer.