get_group_role_label( $group_id, $label_name )
Get group roles labels.
Description
Parameters
- $group_id
-
(Required)
- $label_name
-
(Required)
Return
(string)
Source
File: bp-groups/bp-groups-functions.php
function get_group_role_label( $group_id, $label_name ) { if ( '' === $group_id || '' === $label_name ) { return ''; } // Get group type of given group id. $get_group_type = bp_groups_get_group_type( $group_id ); if ( ! $get_group_type ) { if ( 'organizer_plural_label_name' === $label_name ) { $label = 'Organizers'; } elseif ( 'moderator_plural_label_name' === $label_name ) { $label = 'Moderators'; } elseif ( 'member_plural_label_name' === $label_name ) { $label = 'Members'; } elseif ( 'organizer_singular_label_name' === $label_name ) { $label = 'Organizer'; } elseif ( 'moderator_singular_label_name' === $label_name ) { $label = 'Moderator'; } elseif ( 'member_singular_label_name' === $label_name ) { $label = 'Member'; } } else { $group_type_post_id = bp_get_group_type_post_id( $get_group_type ); if ( '' === $group_type_post_id ) { if ( 'organizer_plural_label_name' === $label_name ) { $label = 'Organizers'; } elseif ( 'moderator_plural_label_name' === $label_name ) { $label = 'Moderators'; } elseif ( 'member_plural_label_name' === $label_name ) { $label = 'Members'; } elseif ( 'organizer_singular_label_name' === $label_name ) { $label = 'Organizer'; } elseif ( 'moderator_singular_label_name' === $label_name ) { $label = 'Moderator'; } elseif ( 'member_singular_label_name' === $label_name ) { $label = 'Member'; } } $group_type_roles = get_post_meta( $group_type_post_id, '_bp_group_type_role_labels', true ) ?: []; if ( 'organizer_plural_label_name' === $label_name ) { $label = ( isset( $group_type_roles['organizer_plural_label_name'] ) && $group_type_roles['organizer_plural_label_name'] ) ? $group_type_roles['organizer_plural_label_name'] : 'Organizers'; } elseif ( 'moderator_plural_label_name' === $label_name ) { $label = ( isset( $group_type_roles['moderator_plural_label_name'] ) && $group_type_roles['moderator_plural_label_name'] ) ? $group_type_roles['moderator_plural_label_name'] : 'Moderators'; } elseif ( 'member_plural_label_name' === $label_name ) { $label = ( isset( $group_type_roles['member_plural_label_name'] ) && $group_type_roles['member_plural_label_name'] ) ? $group_type_roles['member_plural_label_name'] : 'Members'; } elseif ( 'organizer_singular_label_name' === $label_name ) { $label = ( isset( $group_type_roles['organizer_singular_label_name'] ) && $group_type_roles['organizer_singular_label_name'] ) ? $group_type_roles['organizer_singular_label_name'] : 'Organizer'; } elseif ( 'moderator_singular_label_name' === $label_name ) { $label = ( isset( $group_type_roles['moderator_singular_label_name'] ) && $group_type_roles['moderator_singular_label_name'] ) ? $group_type_roles['moderator_singular_label_name'] : 'Moderator'; } elseif ( 'member_singular_label_name' === $label_name ) { $label = ( isset( $group_type_roles['member_singular_label_name'] ) && $group_type_roles['member_singular_label_name'] ) ? $group_type_roles['member_singular_label_name'] : 'Member'; } } return apply_filters( 'bp_'.$label_name, $label, $group_id , $label_name); }
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.