Skip to:
Content
Pages
Categories
Search
Top
Bottom

customizing user capabilities


  • Kineta
    Participant

    @kineta

    I’m trying to limit the permissions to assign topic tags to just ‘keymasters’ through the bbp_get_caps_for_role filter.

    This is working, participants can’t see or edit the tag input field

    if ( $role == ‘bbp_participant’ ) {
    $caps[‘assign_topic_tags’] = false;
    }

    but the moderator level is ignored and not working:

    if ( $role == ‘bbp_moderator’ ) {
    $caps[‘assign_topic_tags’] = false;
    }

    I’m a newbie to wordpress development & php. Any insight or advice would be much appreciated. Thanks.

Viewing 1 replies (of 1 total)

  • Kineta
    Participant

    @kineta

    This is my code, fwiw. I don’t want any role but keymasters to add tags. Participant level is working as expected i.e *not* showing but the moderator level is still showing the tag field.

    add_filter( 'bbp_get_caps_for_role', 'my_bbp_role_caps', 10, 2 );
     
    function my_bbp_role_caps( $caps, $role ) {
       if ( $role == 'bbp_participant' ) {
          $caps['assign_topic_tags'] = false;
       }
       if ( $role == 'bbp_moderator' ) {
          $caps['assign_topic_tags'] = false;
       }
       return $caps;
    }
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar