How to disable some Buttons? With the Roles Plugin?

Hi, can someone tell me how I can disable the "add" and "upload" buttons for the default user in the files and the thewire-plugin with the roles plugin?

Here is my Code:

 

        DEFAULT_ROLE => array(
            'title' => 'roles:role:DEFAULT_ROLE',
            'extends' => array(),
            'permissions' => array(
            'actions' => array(
               'groups/edit' => array('rule' => 'deny'),
               'pages/edit' => array('rule' => 'deny'),
                ),
            'pages' => array(
               'groups/add/{$self_guid}' => array('rule' => 'deny'),
               'pages/add/{$self_guid}' => array('rule' => 'deny'),
                ),
            'menus' => array(
                'title::groups:join' => array(
                'rule' => 'deny',
                'context' => array('groups')
                ),
            'page::groups:owned' => array(
                'rule' => 'deny',
                'context' => array('groups')
                ),
            'thewire/add/{$self_guid}' => array(
                'rule' => 'deny',
                'forward' => 'thewire/all',

Disable the "Add Button" in Groups is finished!

Sorry for my bad english .... x)

 

 

  • Buttons are actions. You have to restrict actions.

    Rodolfo Hernandez

    Arvixe/Elgg Community Liaison

  • Nope @rjcalifornia: buttons are menu items, so you need to deny access to the corresponding menu items using the roles plugin framework.

    Sidenote: there are newer versions of the roles plugins available on the github account of Ark Interactive. I thinks its better to use these newer versions as they seems to contain some new functionality, too.

    Regarding the files plugin the hiding of the Add button should work similar to hiding for example the blogs Add button which had been explained (only in German but nevertheless) only recently.

    The Wire plugin has no Add button as far as I know but the Input form in inline on the wire pages. In this case you would need to hide the input form. This can't be done via the roles configuration but you would need to modify / override the corresponding view and/or form of the wire plugin. The corresponding part of the code would need to be encapsuled in an if-clause that checks the role of the logged-in user. The roles framework has a function to return the role of the logged-in user. Using this function you can easily include such a check.