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
3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 | 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
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.