Skip to:
Content

BuddyPress.org

Changeset 12304


Ignore:
Timestamp:
12/03/2018 08:53:09 PM (8 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.

Merges [12303] to the 4.0 branch.

Props shanebp, dcavins, johnjamesjacoby.
Fixes #8012.

Location:
branches/4.0
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/4.0

    • Property svn:mergeinfo changed
      /trunk (added)merged: 12303
  • branches/4.0/src/bp-blogs/bp-blogs-functions.php

    r12180 r12304  
    130130
    131131                // Omit root blog if large network
    132                 if ( wp_is_large_network( 'users' ) ) {
     132                if ( bp_is_large_install() ) {
    133133                        $sql['omit_root_blog'] = $wpdb->prepare( "AND blog_id != %d", bp_get_root_blog_id() );
    134134                }
  • branches/4.0/src/bp-core/bp-core-functions.php

    r12286 r12304  
    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}
  • branches/4.0/src/bp-friends/bp-friends-functions.php

    r12186 r12304  
    782782
    783783        // Bail out if the site has a ton of users.
    784         if ( is_multisite() && wp_is_large_network( 'users' ) ) {
     784        if ( bp_is_large_install() ) {
    785785                return;
    786786        }
  • branches/4.0/src/bp-groups/bp-groups-admin.php

    r12241 r12304  
    862862 */
    863863function bp_groups_admin_edit_metabox_add_new_members( $item ) {
    864         if ( wp_is_large_network( 'users' ) ) {
     864        if ( bp_is_large_install() ) {
    865865                $class  = '';
    866866                $notice = __( 'Enter a comma-separated list of user logins.', 'buddypress' );
     
    12531253
    12541254        // 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_install() ) {
    12561256                wp_die( -1 );
    12571257        }
Note: See TracChangeset for help on using the changeset viewer.