Skip to:
Content
Pages
Categories
Search
Top
Bottom

Show WordPress role in place of bbPress role


  • Bob1nz
    Participant

    @bob1nz

    Hi

    I have roles setup in wordpress which i would like to display in the forums in place of the bbPress roles.

    Or is there a way to create new bbPress roles with the titles I want then have the roles synchronized with wordpress?

    eg.
    Wordpress –> bbPress
    Guest –> Guest
    Builder –> Builder
    Moderator –> Moderator
    Admin –> Admin
    Co-Owner –> Co-Owner
    Owner –> Owner

    Each role has different capabilities but i would like them to show as different roles on the forums as the titles link up to our small gaming server.

    WordPress Version: 3.8.1
    bbPress Version: 2.5.3-5249
    BuddyPress Version: 1.9.2

    Testing Website: http://bob1nz.com

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

  • Robin W
    Moderator

    @robin-w

    yes, go to

    Layout and functionality – Examples you can use

    and no. 15 if you want to change capabilities


    Bob1nz
    Participant

    @bob1nz

    hmm seems the formatting for that code in 14 is not quite right

    $bbp_roles['my_custom_role1'] = array(
    'name' => 'name 1',
    'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) // the same capabilities as participants
     
    );

    is => supposed to be => (just from other examples I’v seen in other posts)
    it also spat errors at me with the extra empty lines between the lines of code.

    Either way here is the code that works might be worth updating the codex thing

    function add_custom_role( $bbp_roles ) {
    
    $bbp_roles['my_custom_role1'] = array(
    'name' => 'name 1',
    'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) // the same capabilities as participants 
    );
    $bbp_roles['my_custom_role2'] = array(
    'name' => 'name 2',
    'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) // the same capabilities as participants
    );
    $bbp_roles['my_custom_role3'] = array(
    'name' => 'name 3',
    'capabilities' => bbp_get_caps_for_role( bbp_get_keymaster_role() ) // the same capabilities as keymaster 
    );
    return $bbp_roles;
    }
    add_filter( 'bbp_get_dynamic_roles', 'add_custom_role', 1 );

    Thanks heaps for your help 🙂
    Now to play around with this and the capabilities.


    Robin W
    Moderator

    @robin-w

    Thanks, the editor has a habit of changing => and adding lines as you save it, so yes i’ll update.


    Robin W
    Moderator

    @robin-w

    @star100

    Layout and functionality – Examples you can use

    no. 14 & 15


    @bob1nz

    Thanks, I’ve updated the codex, as I say it doesn’t like switching between visual and text, and alters the code if you do. Sop thanks again it should now read correctly

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