bp_get_user_group_role_title( int $user_id = false, int $group_id = false )
Get the member’s group role
Description
Parameters
- $user_id
-
(Optional) ID of the user.
Default value: false
- $group_id
-
(Optional) ID of the group.
Default value: false
Return
(string)
Source
File: bp-groups/bp-groups-functions.php
3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 | function bp_get_user_group_role_title( $user_id = false, $group_id = false ) { if ( ! $user_id && ! $group_id ) return '' ; $role_title = '' ; if ( groups_is_user_admin( $user_id , $group_id ) ) { $role_title = __( get_group_role_label( $group_id , 'organizer_singular_label_name' ), 'buddyboss' ); } elseif ( groups_is_user_mod( $user_id , $group_id ) ) { $role_title = __( get_group_role_label( $group_id , 'moderator_singular_label_name' ), 'buddyboss' ); } elseif ( groups_is_user_member( $user_id , $group_id ) ) { $role_title = __( get_group_role_label( $group_id , 'member_singular_label_name' ), 'buddyboss' ); } /** * Filters member's group role title * * @since BuddyBoss 1.0.0 * * @param string $role_title User group role title. */ return apply_filters( 'bp_get_user_group_role_title' , $role_title ); } |
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.