bp_core_get_total_member_count

Return the total number of members for the installation.

Description

(int) bp_core_get_total_member_count(); 

Note that this is a raw count of non-spam, activated users. It does not account for users who have logged activity (last_active). See .

Returns (int)

The total number of members.


Usage

  1. if ( !function_exists( 'bp_core_get_total_member_count' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-members/bp-members-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_core_get_total_member_count(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/bp-members/bp-members-functions.php  
  1. function bp_core_get_total_member_count() { 
  2. global $wpdb; 
  3.  
  4. $count = wp_cache_get( 'bp_total_member_count', 'bp' ); 
  5.  
  6. if ( false === $count ) { 
  7. $status_sql = bp_core_get_status_sql(); 
  8. $count = $wpdb->get_var( "SELECT COUNT(ID) FROM {$wpdb->users} WHERE {$status_sql}" ); 
  9. wp_cache_set( 'bp_total_member_count', $count, 'bp' ); 
  10.  
  11. /** 
  12. * Filters the total number of members for the installation. 
  13. * @since 1.2.0 
  14. * @param int $count Total number of members. 
  15. */