Skip to:
Content

bbPress.org


Ignore:
Timestamp:
01/13/2017 07:29:26 PM (8 years ago)
Author:
johnjamesjacoby
Message:

Upgrade: Introduce bbp_is_large_install() to abstract wp_is_large_network() which is a multisite-only function.

See #2959.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/core/abstraction.php

    r6106 r6243  
    155155    return (float) $wp_version;
    156156}
     157
     158/**
     159 * Is this a large bbPress installation?
     160 *
     161 * @since 2.6.0 bbPress (r6242)
     162 *
     163 * @return bool True if more than 10000 users, false not
     164 */
     165function bbp_is_large_install() {
     166
     167    // Default to false
     168    $retval = false;
     169
     170    // Multisite has a function specifically for this
     171    if ( function_exists( 'wp_is_large_network' ) ) {
     172        $retval = wp_is_large_network( 'users' );
     173    } else {
     174        $bbp_db = bbp_db();
     175        $count  = $bbp_db->get_var( "SELECT COUNT(ID) as c FROM {$bbp_db->users} WHERE user_status = '0'" );
     176        $retval = apply_filters( 'wp_is_large_network', ( $count > 10000 ), 'users', $count );
     177    }
     178
     179    return (bool) $retval;
     180}
Note: See TracChangeset for help on using the changeset viewer.