bbp_group_is_member()

Is the current user a member of the current group

Description

Return

(bool) If current user is a member of the current group

Source

File: bp-forums/functions.php

637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
function bbp_group_is_member() {
 
    // Bail if user is not logged in or not looking at a group
    if ( ! is_user_logged_in() || ! bp_is_group() )
        return false;
 
    $bbp = bbpress();
 
    // Set the global if not set
    if ( ! isset( $bbp->current_user->is_group_member ) )
        $bbp->current_user->is_group_member = groups_is_user_member( get_current_user_id(), bp_get_current_group_id() );
 
    // Return the value
    return (bool) $bbp->current_user->is_group_member;
}

Changelog

Changelog
Version Description
bbPress (r4632) 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.