Roles plugin : can't hide friends tab in filter menu for specific role

Hello everybody,

I'm pretty new to Elgg and I learnt a lot these past weeks. Your discussions were very helpful to me and I solved lots of questions thanks to previous posts. But now I face a trouble I'm not able to fix so I need your help.

I'm using Elgg 1.10 with Roles plugin. I modified Moderators for Roles plugin to create a new role for my specific need. I want this role hide friends tab in filter menu in 'Files' page and hide 'upload a file' in this same page.

Inspired by the plugin documentation, I tried different solutions, without success :

What is working :

'menus' => array(
                    'site::members' => array('rule' => 'deny'),
                    'site::activity' => array('rule' => 'deny'),
                    'footer::terms' => array('rule' => 'deny'))

OK, i'm able to hide members and activity site menus and terms in footer.

What is not working :

'menus' => array(
                    'filter::all' => array(
                        'rule' => 'deny',
                        'context' => array('file','blog')
                    ),
                    'title::add' => array(
                        'rule' => 'deny',
                        'context' => array('groups','file')
                    ),

Neither Filter::All and Title::Add are working. According to the documentation, it should work. I also tried filter::friends and other things, without success. I also tried to modify the context but it should not be the root cause.

My question is : do Elgg new release modify some things in menu management which prevent me use the plugin ? How could I answer to my need ?

Any help appreciated,

Thank you, Baptiste

  • Where is ')' at the end?

    Try this:

    'menus' => array(
                        'filter::all' => array(
                            'rule' => 'deny',
                            'context' => array('file','blog')
                        ),
                        'title::add' => array(
                            'rule' => 'deny',
                            'context' => array('groups','file')
                        ),

    )

    Also, try flush the cache after changes

     

  • I don't think the filters go through the menu plugin hooks, and if I'm right that means they can't be affected by roles

  • I'm not right, the default filter does use the menu system.  However it can be overridden with any arbitrary html, so it may be the case that another plugin is overwriting the filter with html that wasn't generated with the menu system.

  • hi every body i want some information about simple cache url 4example : address / how it work / goal & ... tnx Reply to this Edit HTML

  • @fateme, don't cross-post and hijack threads.

  • Hello all,

    Thank you for your answers. Actually I found the problem : my syntax, like examples given in the manual was right. But when I put a specific context for a role it doesn't work with the following function declared on lib/roles.php (from roles plugin) : roles_check_context.

    I saw that there was an argument to apply another way of checking context, the boolean "strict". I applied it in the roles_menus_permissions function (in start.php), where roles_check_context is called.

    So line 207 --> roles_check_context($perm_details, true) works good.

    Thank you,

    Baptiste

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking