I’m not sure if bbPress follows WordPress conventions, but WP has a global class called $WP-roles
that holds the role information. So, starting from what you have, there is the role of the current user:
$current_role = $user->roles[1];
Next, retrieve a list of all roles:
$all_roles = $wp_roles->roles;
Then, loop through $all_roles
and find the $current_role"
:
foreach ($all_roles as $role_key => $role_details) {
if ($role_key == $current_role) $current_role_name = $role_details['name'];
}
Now, $current_role_name
should hold the display name you’re looking for (I didn’t check this code, however).
Related Posts:
- Assigning multiple or additional capabilities to specific users or how to create additional roles like bbpress roles?
- Editor can create any new user except administrator
- How to allow an user role to create a new user under a role which lower than his level only?
- Remove Ability for Other Users to View Administrator in User List?
- Find out if logged in user is not subscriber
- User-edit role setting distinct from wp_capabilities? [closed]
- Allowing users to edit only their page and nobody else’s
- alphabetically order role drop-down selection in dashboard
- How to let contributors to create a new revision(draft) editing their published posts
- Disallowing Users of a Custom Role from Deleting or Adding Administrators?
- What the user_status column?
- Hide Admin Menu for Specific User ID who has administrator Role
- How to hide media uploads by other users in the Media menu?
- Show admin bar only for some USERS roles
- Grouping users under parent user
- How to update user role without logout
- How to check user role without using current_user_can()
- Do not allow users to create new posts and pages
- \WP_User Object | What’s the Difference Between {caps} and {allcaps}?
- How to assign capabilities to user NOT to User Role
- How to assign an additional/extra/second user-role to multiple users (of a specific user-role)
- How to stop a user from updating the post date
- BuddyPress | Check if user is in current group [closed]
- Return ID of authors who have at least one post
- WordPress edit_user_profile_update update secondary role
- How-to Delay The Capability To Publish Posts?
- How to customize wp_signon()
- Is it possible to get a user with just the password field?
- set_role has no effect
- WP_User->add_role producing unexpected results
- How can I check if the admin bar is visible to the current user?
- Set default page for user account in admin
- Users roles, make a page belonging to multiple users
- Tagging users in WordPress
- How do I list in the backend all users that were assigned to a custom role?
- How to add local users to wordpress without email password?
- Hide everything on site for visitors except specific page IDs
- Get User Role by ID not working
- the_author_meta(‘user_url’, $author->ID) not working properly. how can I solve this?
- add_cap not working with Shop Manager role
- Managing Users and Creating Groups [closed]
- Multiple Backend Users as single Frontend User
- Are User Levels Still Currently Used?
- Error: How to allow the “contributor” to upload media in wordpress
- How to export bbPress (forums, topics, replies) and all users?
- Remove Capabilities from WP admin for specific user role
- Updating wp_user_level on user update
- wordpress user roles are not working
- Fix permissions for users role
- What are some best practices for user exit strategy?
- Is there a way to identify a user in a custom REST API method? [duplicate]
- Problem with automatic role change through cron job
- How can I allow an User to publish only 5 posts per month?
- Is possible to allow user to login with different role?
- Where are $current_user->allcaps set?
- How change user type from contributor to author
- How do I let contributors edit their posts after being approved once?
- Does wordpress support natively the concept of logging-in users? (not admins, but users of the website)
- How many people are allowed to use same wordpress account at the same time?
- Load user by specific role
- How to hide user profile fields based on the role of the viewed user?
- Fix ‘Add Role’ Option not there in wordpress 5.2.2
- Allow Users to Modify Some Values of Assigned WordPress Pods [closed]
- Can I Create a Second Admin Level User Role?
- Customising “user ids” and add to ‘user’ panel in the admin area
- How to hide some users to unlogged users [closed]
- List all users and current week entries
- Groups and subgroups for permission
- how do I add role and capability after I create a new user
- Get Authors Role
- Using my own user table
- WordPress user role with create user capability?
- Editor role can only create/edit/delete users who have one of two roles
- User can’t search himself on rest api
- Update user role for expired membership
- Find count of WordPress users by role and search string for user name
- Hook into add_user_role and update based on new and removed roles
- How to Moderate Edits to User Profiles?
- fine-grained capabilities for user related capabilities
- Create relationships between users or user roles
- Updated user role inncorrect when using wp_get_current_user()
- User Permissions on custom post type
- In admin manage users page, how can I stop users with certain privileges from editing users with other privileges?
- Groups roles & capabilities
- Custom User Role: Can Edit Own Page, Cannot Create New
- Show user details only
- Button for users to upgrade their user role + Button to show current user role!
- Access level seems to have gone from admin to editor
- Restrict Access to the User Profile
- Subscriber role – blank page
- How to get only 1 role from user
- Front end login and page restriction
- User “none” role
- Limit roles displayed in users.php depending on custom role
- i need to let a user to add a role from a frontend form
- Limit user access to installing/configuring a plugin?
- Increase by one the user counter on specific role
- current_user_can() returning true for capability when the user and role do not have the capability
- How to create a specific role to manage users
- Cant edit profile from frontend