Get a total group count for the site.

Description Description

Will include hidden groups in the count only if bp_current_user_can( ‘bp_moderate’ ).

Top ↑

Return Return

(int) Group count.

Source Source

File: bp-groups/classes/class-bp-groups-group.php

	public static function get_total_group_count() {
		global $wpdb;

		$hidden_sql = '';
		if ( !bp_current_user_can( 'bp_moderate' ) )
			$hidden_sql = "WHERE status != 'hidden'";

		$bp = buddypress();

		return $wpdb->get_var( "SELECT COUNT(id) FROM {$bp->groups->table_name} {$hidden_sql}" );

Top ↑

Changelog Changelog

Version Description
1.6.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.