bbp_get_user_display_role( int $user_id )
Return a user’s main role for display
Description
Parameters
- $user_id
-
(Required)
Return
(string)
Source
File: bp-forums/users/template.php
function bbp_get_user_display_role( $user_id = 0 ) { // Validate user id $user_id = bbp_get_user_id( $user_id ); // User is not registered if ( empty( $user_id ) ) { $role = __( 'Guest', 'buddyboss' ); // User is not active } elseif ( bbp_is_user_inactive( $user_id ) ) { $role = __( 'Inactive', 'buddyboss' ); // User have a role } else { $role_id = bbp_get_user_role( $user_id ); $role = bbp_get_dynamic_role_name( $role_id ); } // No role found so default to generic "Member" if ( empty( $role ) ) { $role = __( 'Member', 'buddyboss' ); } return apply_filters( 'bbp_get_user_display_role', $role, $user_id ); }
Changelog
Version | Description |
---|---|
bbPress (r3860) | 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.