bp_group_status_message( object|null $group = null )

Prints a message if the group is not visible to the current user (it is a hidden or private group, and the user does not have access).

Description

Parameters

$group

(Optional) Group to get status message for. Optional; defaults to current group.

Default value: null

Source

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

4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
function bp_group_status_message( $group = null ) {
    global $groups_template;
 
    // Group not passed so look for loop.
    if ( empty( $group ) ) {
        $group =& $groups_template->group;
    }
 
    // Group status is not set (maybe outside of group loop?).
    if ( empty( $group->status ) ) {
        $message = __( 'This group is not currently accessible.', 'buddyboss' );
 
    // Group has a status.
    } else {
        switch( $group->status ) {
 
            // Private group.
            case 'private' :
                if ( ! bp_group_has_requested_membership( $group ) ) {
                    if ( is_user_logged_in() ) {
                        if ( bp_group_is_invited( $group ) ) {
                            $message = __( 'You must accept your pending invitation before you can access this private group.', 'buddyboss' );
                        } else {
                            $message = __( 'This is a private group and you must request group membership in order to join.', 'buddyboss' );
                        }
                    } else {
                        $message = __( 'This is a private group. To join you must be a registered site member and request group membership.', 'buddyboss' );
                    }
                } else {
                    $message = __( 'This is a private group. Your membership request is awaiting approval from the group organizer.', 'buddyboss' );
                }
 
                break;
 
            // Hidden group.
            case 'hidden' :
            default :
                $message = __( 'This is a hidden group. You must be invited to join.', 'buddyboss' );
                break;
        }
    }
 
    /**
     * Filters a message if the group is not visible to the current user.
     *
     * This will be true if it is a hidden or private group, and the user does not have access.
     *
     * @since BuddyPress 1.6.0
     *
     * @param string $message Message to display to the current user.
     * @param object $group   Group to get status message for.
     */
    echo apply_filters( 'bp_group_status_message', $message, $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.