bp_group_get_album_status( int|bool $group_id = false )

Get the album status of a group.

Description

This function can be used either in or out of the loop.

Parameters

$group_id

(Optional) The ID of the group whose status you want to check. Default: the displayed group, or the current group in the loop.

Default value: false

Return

(bool|string) Returns false when no group can be found. Otherwise returns the group album status, from among 'members', 'mods', and 'admins'.

Source

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

2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
function bp_group_get_album_status( $group_id = false ) {
    global $groups_template;
 
    if ( !$group_id ) {
        $bp = buddypress();
 
        if ( isset( $bp->groups->current_group->id ) ) {
            // Default to the current group first.
            $group_id = $bp->groups->current_group->id;
        } elseif ( isset( $groups_template->group->id ) ) {
            // Then see if we're in the loop.
            $group_id = $groups_template->group->id;
        } else {
            return false;
        }
    }
 
    $album_status = groups_get_groupmeta( $group_id, 'album_status' );
 
    // Backward compatibility. When 'album_status' is not set, fall back to a default value.
    if ( !$album_status ) {
        $album_status = apply_filters( 'bp_group_album_status_fallback', 'members' );
    }
 
    /**
     * Filters the album status of a group.
     *
     * Invite status in this case means who from the group can send invites.
     *
     * @since BuddyBoss 1.0.0
     *
     * @param string $album_status Membership level needed to manage albums.
     * @param int    $group_id      ID of the group whose status is being checked.
     */
    return apply_filters( 'bp_group_get_album_status', $album_status, $group_id );
}

Changelog

Changelog
Version Description
BuddyBoss 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.