Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to change/create fourm roles

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

  • Robin W
    Moderator

    @robin-w


    Robin W
    Moderator

    @robin-w


    olliewe88
    Participant

    @olliewe88

    Custom Capabilities

    Thank you however for the link above where do you find the code to edit @robin-w


    Robin W
    Moderator

    @robin-w

    the code is additional and goes in your functions.php

    see

    Functions files and child themes – explained !


    tech55541
    Participant

    @tech55541

    Hello @robin-w,
    I thought this plugin might help me to allow participants to trash but not delete their own topics, but I was wrong. There is only a delete capability and a moderate capability. The moderate capability gives users way too much access while the delete capability is useless if a user cannot first trash the topic. I do not want users to be able to delete their own topics or replies anyway. Any suggestions to just allow the user to trash their own topics and replies?

    Thanks.


    olliewe88
    Participant

    @olliewe88

    hi again @robin-w

    Ok so I have put the code below in the functions.php

    function add_new_roles( $bbp_roles )
    {
    /* role the new role*/
    $bbp_roles[‘bbp_Facepainter’] = array(
    ‘name’ => ‘Facepainter’,
    ‘capabilities’ => custom_capabilities( ‘bbp_Facepainter’ )
    );

    return $bbp_roles;
    }

    add_filter( ‘bbp_get_dynamic_roles’, ‘add_new_roles’, 1 );

    function add_role_caps_filter( $caps, $role )
    {
    /* Only filter for roles we are interested in! */
    if( $role == ‘bbp_Facepainter’ )
    $caps = custom_capabilities( $role );

    return $caps;
    }

    add_filter( ‘bbp_get_caps_for_role’, ‘add_role_caps_filter’, 10, 2 );

    function custom_capabilities( $role )
    {
    switch ( $role )
    {

    /* Capabilities for ‘Facepainter’ role */
    case ‘bbp_Facepainter’:
    return array(
    // Primary caps
    ‘spectate’ => true,
    ‘participate’ => true,
    ‘moderate’ => false,
    ‘throttle’ => false,
    ‘view_trash’ => false,

    // Forum caps
    ‘publish_forums’ => false,
    ‘edit_forums’ => false,
    ‘edit_others_forums’ => false,
    ‘delete_forums’ => false,
    ‘delete_others_forums’ => false,
    ‘read_private_forums’ => true,
    ‘read_hidden_forums’ => false,

    // Topic caps
    ‘publish_topics’ => true,
    ‘edit_topics’ => true,
    ‘edit_others_topics’ => false,
    ‘delete_topics’ => false,
    ‘delete_others_topics’ => false,
    ‘read_private_topics’ => true,

    // Reply caps
    ‘publish_replies’ => true,
    ‘edit_replies’ => true,
    ‘edit_others_replies’ => false,
    ‘delete_replies’ => false,
    ‘delete_others_replies’ => false,
    ‘read_private_replies’ => true,

    // Topic tag caps
    ‘manage_topic_tags’ => false,
    ‘edit_topic_tags’ => false,
    ‘delete_topic_tags’ => false,
    ‘assign_topic_tags’ => true,
    );

    break;

    default :
    return $role;
    }
    }}

    However, it is still not working. It shows when I go to Users,user,Forum Role and set it to facepainter but when I save it, it still doesn’t set their fourm role to face painter?!

    Thanks for you help


    Robin W
    Moderator

    @robin-w

    However, it is still not working. It shows when I go to Users,user,Forum Role and set it to facepainter but when I save it, it still doesn’t set their fourm role to face painter?!

    As in it sets it and shows but doesn’t work, or doesn’t show or doesn’t do what is expected?

    Cab you explain in terms of ‘I press this and this shows/doesn’t show’ please


    Robin W
    Moderator

    @robin-w

    @tech55541 would need a custom filter and take me too much time to work out at the moment – sorry


    olliewe88
    Participant

    @olliewe88

    Afternoon @robin-w

    http://postimg.org/image/jiddpiaq9/
    As you can see in the image above I set the forum role to Facepainter

    http://postimg.org/image/ukigny4sx/
    Then I save it


    olliewe88
    Participant

    @olliewe88

    http://postimg.org/image/u6h4ockpd/
    However when I go to users in word press it still doesn’t show that their role is facepainter?


    Robin W
    Moderator

    @robin-w

    1. if you go back into the user, does it show as set for the user?

    2. Where is that second screenshot from?


    olliewe88
    Participant

    @olliewe88

    @robin-w

    1. When I go back to the user it says no role for these forums, but at the bottom it says

    Additional Capabilities
    Capabilities bbp_Facepainter

    2. The second screen-shot is after I update the user.


    Robin W
    Moderator

    @robin-w

    Sorry meant third screenshot from where? ie what do you go into to get this

    http://postimg.org/image/u6h4ockpd/


    olliewe88
    Participant

    @olliewe88

    I just clicked on users in wordpress @robin-w

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