Skip to:
Content
Pages
Categories
Search
Top
Bottom

Give KeyMaster user rights to a custom WP user

  • @dansearle

    Participant

    Hi,

    I’m running WP 3.8 with BuddyPress 1.9 and bbPress 2.5.1.

    I’m writing my own theme and I want to create a new WP user role, “Special Admin” which is a normal admin user but with restrictions that I’ve manually applied in my theme functions.php.

    What I now need to do is to give that user the KeyMaster rights for bbPress, but I can’t see how to do that.

    My site actually comprises 3 themes, and this user will use all 3, so to avoid code repetition I’m setting up the rights in a bespoke plugin I’m writing.

    I thought from reading the bbPress source that I could use the filter bbp_get_user_role_map to add. Here’s the code I’m trying:

    // Give the Special Administrator the Keymaster capabilities.
    
    add_filter('bbp_get_user_role_map', 'add_keymaster_to_special_administrator');
    
    function add_keymaster_to_special_administrator($role_map){
        $role_map['special_administrator'] = bbp_get_keymaster_role();
    
        return $role_map;
    }

    The problem is that the filter is never processed – I’ve thrown a die in there to check and it’s not being executed.

    Can anyone tell me what I’m missing?

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