Skip to:
Content
Pages
Categories
Search
Top
Bottom

Adding New Role Mess The Site


  • istrix
    Participant

    @istrix

    Please help me create a new bbp role w/c is VIP.

    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'         => 'Administrator',
                'capabilities' => bbp_get_caps_for_role( bbp_get_keymaster_role() )
            ),
      
            // Moderator
            bbp_get_moderator_role() => array(
                'name'         => 'Moderator',
                'capabilities' => bbp_get_caps_for_role( bbp_get_moderator_role() )
            ),
      
            // Participant
            bbp_get_participant_role() => array(
                'name'         => 'Member',
                'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() )
            ),
      
            // VIP
            bbp_get_participant_role() => array(
                'name'         => 'VIP',
                'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() )
            ),
      
            // Spectator
            bbp_get_spectator_role() => array(
                'name'         => 'Guest',
                'capabilities' => bbp_get_caps_for_role( bbp_get_spectator_role() )
            ),
      
            // Blocked
            bbp_get_blocked_role() => array(
                'name'         => 'Banned',
                'capabilities' => bbp_get_caps_for_role( bbp_get_blocked_role() )
            )
        );
    }
Viewing 4 replies - 1 through 4 (of 4 total)

  • Robin W
    Moderator

    @robin-w

    if tyoun just want a role called VIP with participant capabilities, then undo whatever you did above, and then put this in your functions file

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

    istrix
    Participant

    @istrix

    @robin-w
    I undo my post above in functions file then paste the code you provide.

    Then…

    The site.domain page isn’t working

    site.domain is currently unable to handle this request.
    HTTP ERROR 500

    please help


    Robin W
    Moderator

    @robin-w

    sorry the code is/was untested.

    Try this with a correction

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

    istrix
    Participant

    @istrix

    Thanks! It worked! Kindly mark this thread as solved.

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