Skip to:
Content
Pages
Categories
Search
Top
Bottom

2 User Names with one Role Capability


  • Kalusha
    Participant

    @kalusha

    Hello,

    I need 2 User Names which have the same capabilitys. I have try it with this:

    add_filter( ‘bbp_get_dynamic_roles’, ‘ntwb_bbpress_custom_role_names’ );

    function ntwb_bbpress_custom_role_names() {
    return array(

    // Participant
    bbp_get_participant_role() => array(
    ‘name’ => ‘Standard User’,
    ‘capabilities’ => bbp_get_caps_for_role( bbp_get_participant_role() )
    ),

    // Spectator
    bbp_get_spectator_role() => array(
    ‘name’ => ‘–>Premium User<–‘,
    ‘capabilities’ => bbp_get_caps_for_role( bbp_get_participant_role() )
    )
    );
    }

    Now I can swith between “Standard User” and “Premium User” which is perfect, but he Premium User can not write any reply or other things. So they have not the same capaboility.

    Have anybody an idea where the mistake is?

    Which Member Plugin works good with WordPress and bbPress? All I try were not good 🙁

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

  • Robin W
    Moderator

    @robin-w

    follow this link with a description on how to do this

    Custom Capabilities


    Kalusha
    Participant

    @kalusha

    Thank you Robin…. but I try and try and it doesn´t work:(


    Robin W
    Moderator

    @robin-w

    can you paste the exact code you are using into here, and I’ll check it


    Kalusha
    Participant

    @kalusha

    I have now this code into functions

    ##Name ändern Participant in User Standard User
    function my_custom_roles( $role, $user_id ) {
    if( $role == ‘Teilnehmer’ )
    return ‘Standard User’;

    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 ‘Michael’;

    return $role;
    }

    add_filter( ‘bbp_get_user_display_role’, ‘my_custom_roles2’, 10, 2 );

    function my_custom_roles3( $role, $user_id ) {
    if( $role == ‘Zuschauer’ )
    return ‘Premium User’;

    return $role;
    }

    add_filter( ‘bbp_get_user_display_role’, ‘my_custom_roles3’, 10, 2 );

    So I change only the names. Now I must to have that the spectator has the same capability as the participants. So I have no code for this found, I have change the capability.php in bbpress core. I know it´s not the best way and after a Update I must change it again but it works. I have no other idea. 🙁

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