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
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
| 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.