Skip to:
Content
Pages
Categories
Search
Top
Bottom

Changing name of "Key Master"


  • rmazereeuw
    Participant

    @rmazereeuw

    I have bbpress Version 2.1.2 installed and in the forum itself the admin’s profile shows the phrase “Key Master” under (where a normal user shows “Subscriber.” How can I change the wording of “Key Master” to something else, like Site Owner or something?

    Just to be clear: Permissions and functions are all working as expected: This is purely changing the wording visible in the forum itself, just like in this forum it shows “member” under my name.

    Tried searching on this with no luck. Older forum discussions mention being able to change this at the user account level in WP, but I see no options there.

    Thanks for any suggestions!

Viewing 13 replies - 1 through 13 (of 13 total)

  • dprundle
    Participant

    @dprundle

    I would also love to know the answer to this question! I checked on the users page with no luck.


    zaerl
    Participant

    @zaerl

    Put this code somewhere in your theme functions.php

    https://gist.github.com/4086011

    Otherwise you can change the roles editing the bbPress gettext file. Check ‘\wp-content\plugins\bbpress\bbp-languages\bbpress.pot’, create a .po for your language (if you already hasn’t one) and change the string “Key Master” at line 3311. If you don’t know what I’m talking about I can generate the file for you.


    dprundle
    Participant

    @dprundle

    Zaerl, worked perfectly. Thank you.

    For those that want to know exactly what I did:
    I edited functions.php in my twentyeleven child theme and added the function he provided via the github link.

    After that the role of Key Master now displays as Site Owner.

    Thanks Zaerl.


    anthonyluth09
    Participant

    @anthonyluth09

    I’m having issues with this using 2.2 of the bbPress. I did edit the line you suggested but I don’t believe that it’s being handled in the same spot in the new release. Any thoughts?


    Sam Rohn
    Participant

    @sam-rohn

    use this plugin, it allows changing bbpress user role names and other bbpress standard text

    https://wordpress.org/extend/plugins/bbpress-string-swap/

    sam


    koendb
    Participant

    @koendb

    Thanks Zearl, need to modify your code slightly to get it to work:
    Had to remove ‘$user_role’

    function my_custom_roles( $role, $user_id ) {
    if( $role == ‘Key Master’ )
    return ‘Site Owner’;
    return $role;
    }
    add_filter( ‘bbp_get_user_display_role’, ‘my_custom_roles’, 10, 3 );


    sharongraylac
    Participant

    @sharongraylac

    Hello!

    I followed the github recommendations below:

    function my_custom_roles( $role, $user_id, $user_role ) {
    if( $role == ‘Key Master’ )
    return ‘Site Owner’;
    return $role;
    }
    add_filter( ‘bbp_get_user_display_role’, ‘my_custom_roles’, 10, 3 );

    And I get this error on my bbpress page:

    Warning: Missing argument 3 for my_custom_roles() in /home/belly/public_html/wp-content/themes/kickstart-child/functions.php on line 90

    The page does still come up, but this is visible above the author’s avatar.

    Any thoughts?

    Thanks!
    Sharon


    Robkk
    Moderator

    @robkk

    try this code from this link

    https://gist.github.com/ntwb/7864894

    and rename the ones you want

    add_filter( 'bbp_get_dynamic_roles', 'ntwb_bbpress_custom_role_names' );
    
    function ntwb_bbpress_custom_role_names() {
    	return array(
    
    		// Keymaster
    		bbp_get_keymaster_role() => array(
    			'name'         => 'My Custom Keymaster Role Name',
    			'capabilities' => bbp_get_caps_for_role( bbp_get_keymaster_role() )
    		),
    
    		// Moderator
    		bbp_get_moderator_role() => array(
    			'name'         => 'My Custom Moderator Role Name',
    			'capabilities' => bbp_get_caps_for_role( bbp_get_moderator_role() )
    		),
    
    		// Participant
    		bbp_get_participant_role() => array(
    			'name'         => 'My Custom Participant Role Name',
    			'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() )
    		),
    
    		// Spectator
    		bbp_get_spectator_role() => array(
    			'name'         => 'My Custom Spectator Role Name',
    			'capabilities' => bbp_get_caps_for_role( bbp_get_spectator_role() )
    		),
    
    		// Blocked
    		bbp_get_blocked_role() => array(
    			'name'         => 'My Custom Blocked Role Name',
    			'capabilities' => bbp_get_caps_for_role( bbp_get_blocked_role() )
    		)
    	);
    }

    benklocek
    Participant

    @benklocek

    I’ve updated the filter code to make it work for BBPress 2.5.7+

    https://gist.github.com/benklocek/433713bceb83eec6984f

    The Keymaster title changed from “Key Master” to “Keymaster” at some point, and the filter only accepts 2 variables now.

    I would be hesitant to use @robkk’s code, as it is replacing a core function, instead of simply filtering.


    Manuel Fritsch
    Participant

    @let-me-see

    I wanted to change two titles, so I wrote this (had to take the translated strings though, so this fix will fail again when roles are renamed in bbress or our locale):

    function my_custom_roles( $role, $user_id ) {
    	if( $role == 'Teilnehmer' )
    		return ' ';
    
    	return $role;
    	
    }
    
    add_filter( 'bbp_get_user_display_role', 'my_custom_roles', 10, 2 );
    
    function my_custom_roles2( $role, $user_id ) {
    	if( $role == 'Keymaster' )
    		return 'Administrator';
    
    	return $role;
    }
    
    add_filter( 'bbp_get_user_display_role', 'my_custom_roles2', 10, 2 );

    u_Oi
    Participant

    @arutam

    Thanks for the code @benklocek

    I created a custom role with this code:

    //Custom Role Admin
    function add_custom_role( $bbp_roles ) {
     $bbp_roles['my_custom_role1'] = array(
    'name' => 'Admin',
    'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) // the same capabilities as admin
    
    );
    
    return $bbp_roles;
     }
     add_filter( 'bbp_get_dynamic_roles', 'add_custom_role', 1 );

    and I can’t change the role name with @robkk code. But I did with your code. So I wonder what should I change to apply your code for all other roles, participant, moderator?

    Thanks!

    I tried couple ways but without success. Ex:

    function my_custom_roles( $role, $user_id ) {
    	if( $role == 'Participant' )
    		return 'Participante';
    
    	return $role;
    }
    
    add_filter( 'bbp_get_user_display_role', 'my_custom_roles', 10, 2 );

    benklocek
    Participant

    @benklocek

    Here’s the list of names as set by default: http://hookr.io/functions/bbp_get_dynamic_roles/

    You should be able to use:

    $roles = bbp_get_dynamic_roles();
    $print_r( $roles );

    to see what the names of your roles are.


    u_Oi
    Participant

    @arutam

    Thanks for the answer @benklocek

    I am still looking for the right code, I will post here once I got it 😉

    I was thinking what could be the best way…

    1.-Create a custom role and then use the name of role to translate it. (I am doing this.)
    2.-Give to spectator role the participant´s capabilities and then translate it.

    I need two participant roles, with differents name. Just to make more fun the forum style. Just like the ticket about “Add CSS class for user roles in topics and replies”.

    Regards,

Viewing 13 replies - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.
Skip to toolbar