Skip to:
Content
Pages
Categories
Search
Top
Bottom

Adding User Roles, but User Title Doesn’t Change


  • cocreationcoaching
    Participant

    @cocreationcoaching

    Hello,

    I added a function in functions.php to add some user roles.

    They are now available, but when I set them on a user, their user title on posts only says “Member”, instead of the name I set.

    Here’s my code:

    function add_custom_role( $bbp_roles ) {
      $bbp_roles['neophyte'] = array( 
        'name' => 'Neophyte I°',
        'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() )
      );
      $bbp_roles['adept'] = array( 
        'name' => 'Adept II°',
        'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() )
      );
    
      return $bbp_roles;
    }   
    add_filter( 'bbp_get_dynamic_roles', 'add_custom_role', 1 );

    How can I get the desired names to actually show up underneath those users?

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

  • Robin W
    Moderator

    @robin-w

    ‘member’ isn’t a bbpress role, so where is this coming from?


    cocreationcoaching
    Participant

    @cocreationcoaching

    In BBPress if no role is found, it defaults to Member. I found that much in the code.

    I solved it though. It wasn’t working as long as my code was in my theme’s functions.php. I had to actually add it to a custom plugin for it to work. Not sure why this was.


    Robin W
    Moderator

    @robin-w

    probably plugin execution order

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