bp_get_group_member_count( object|bool $group = false )

Generate the “x members” count string for a group.


Parameters Parameters

$group

(object|bool) (Optional) Group object. Default: current group in loop.

Default value: false


Top ↑

Return Return

(string)


Source Source

File: bp-groups/bp-groups-template.php

	function bp_get_group_member_count( $group = false ) {
		global $groups_template;

		if ( isset( $group->total_member_count ) ) {
			$count = (int) $group->total_member_count;
		} elseif ( isset( $groups_template->group->total_member_count ) ) {
			$count = (int) $groups_template->group->total_member_count;
		} else {
			$count = 0;
		}

		$count_string = sprintf( _n( '%s member', '%s members', $count, 'buddypress' ), bp_core_number_format( $count ) );

		/**
		 * Filters the "x members" count string for a group.
		 *
		 * @since 1.2.0
		 *
		 * @param string $count_string The "x members" count string for a group.
		 */
		return apply_filters( 'bp_get_group_member_count', $count_string );
	}


Top ↑

Changelog Changelog

Changelog
Version Description
7.0.0 Adds the $group optional parameter.
1.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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