Skip to:
Content
Pages
Categories
Search
Top
Bottom

Problem with custom user role and hidden forums


  • janhoos
    Participant

    @janhoos

    Hey guys!

    I’ve added a custom role to BBpress with this piece of code in a functions.php file in my theme:

    function add_custom_role( $bbp_roles ) {
    $bbp_roles[‘my_custom_role’] = array(
    ‘name’ => ‘ACN Lid’,
    ‘capabilities’ => bbp_get_caps_for_role(bbp_get_participant_role()) // i just want them to have the same capabilities as moderators

    );

    I also have a private forum that only this member can access. Right now it works through a member groups plug-in that shields it. But it still let the off limits posts show up in search results.

    So I want to try and work within the BBpress system of private and hidden forums. Making the forums private won’t solve a thing, because for some weird reason, participants can also view that… Why is that?

    But oh well! I’d like to include the list of capabilities found in the capabilities.php file with this custom role. Instead of the custom role taking the capabilities from the participant. I want to make the members only forums hidden, and make the ACN lid role be able to see the hidden forums.

    How do I change the above code, to make it use the following capabilities:
    $caps = 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’ => true,

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

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

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

  • You must be logged in to reply to this topic.
Skip to toolbar