bp_group_is_member( object|bool $group = false )

Check if current user is member of a group.

Description

Parameters

$group

(Optional) Group to check is_member. Default: current group in the loop.

Default value: false

Return

(bool) If user is member of group or not.

Source

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

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

	// Site admins always have access.
	if ( bp_current_user_can( 'bp_moderate' ) ) {
		return true;
	}

	if ( empty( $group ) ) {
		$group =& $groups_template->group;
	}

	/**
	 * Filters whether current user is member of a group.
	 *
	 * @since BuddyPress 1.2.4
	 * @since BuddyPress 2.5.0 Added the `$group` parameter.
	 *
	 * @param bool   $is_member If user is a member of group or not.
	 * @param object $group     Group object.
	 */
	return apply_filters( 'bp_group_is_member', ! empty( $group->is_member ), $group );
}

Changelog

Changelog
Version Description
BuddyPress 1.0.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.