28 May 2015
How To Change bbPress Role Text In the Topic
In Topic Forum, You may want to change bbPress default member role Text to your own Custom Text. You can Change bbPress Role Text in the Topic forum or remove Unwanted Roled Texts.
In the above Screenshot, you’ll see user role of each member. Suppose, You want to Change the TEXT “Keymaster” to “Admin” and “Participant” to “Member”. There’s an inbuilt bbp_get_dynamic_roles hook you can use to change your own desired text. Make sure you put the file inside the functions.php
file of your active theme. You can also change the role texts by customizing the bbPress file inside the child theme. But we have other options too. Let’s not get there now.
Here’s The Code:
function bbp_custom_role_names() { return array( // Keymaster bbp_get_keymaster_role() => array( 'name' => 'Admin', 'capabilities' => bbp_get_caps_for_role( bbp_get_keymaster_role() ) ), // Participant bbp_get_participant_role() => array( 'name' => 'Member', 'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) ), ); } add_filter( 'bbp_get_dynamic_roles', 'bbp_custom_role_names' );
See The Screenshot
If you want to Change Other Role Texts below is the code.
// Moderator bbp_get_moderator_role() => array( 'name' => 'Your Custom Moderator Role Name', 'capabilities' => bbp_get_caps_for_role( bbp_get_moderator_role() ) ), // Spectator bbp_get_spectator_role() => array( 'name' => 'Your Custom Spectator Role Name', 'capabilities' => bbp_get_caps_for_role( bbp_get_spectator_role() ) ), // Blocked bbp_get_blocked_role() => array( 'name' => 'Your Custom Blocked Role Name', 'capabilities' => bbp_get_caps_for_role( bbp_get_blocked_role() ) )