1

When I create a content type, e.g. 'Basic Page' and I want to add a link to a menu I do usually the following: Menu settings -> Provide a menu link -> choose a menu and its position of the link there

I know, that I can define, which menus are appearing here, in the menu settings section of a content type.

I have several menus, for specific users. For now, if they create a new 'Basic Page' they see all the menus, which are set for this content type. So as well, menus from other users. Is it possible to show just their own menu, so they do not have access to the other menus?

For now I solve this problem by assigning roles for each individual user, and granting permissions for this 'user role' per 'user menu', by using the Menu Admin per Menu module for D7. It would be much more convenient, to use user specific permissions here.

Is there any way, of doing that?

Thank you in advance!

5
  • Hi, Philip. I'm not aware of any module that restricts admin access to a menu by user. Any particular reason for doing it this way? Users come and go, but roles are flexible and reusable. Commented Sep 19, 2015 at 16:32
  • Hi, thanks for your reply. You are right. I am just implementing a page where every user has its own profile page, where he/she can add its own navigation and profile subpages (I control the visibility of the menu by restricting the visibility over the URL-alias, so 'show this menu block just for /user/322/*' for example). Maybe its not the most clever solution, just did not have another idea ;-) I tried to keep this all in one Drupal site, but this one role per user looks so weird, because there are about 30 persons :-(
    – mavicc
    Commented Sep 20, 2015 at 12:18
  • Do you have 30 menus, one per user? If not, you shouldn't need 30 roles since (for example) Role1 could be assigned to Menu1 and Menu2 and Role2 is assigned to Menu3 and Menu4. Then you could also implement some custom code to display the blocks depending on user access (by role) rather than URL which would make managing that part easier: e.g. if on user page and user123 has Role1, display Menu1 and Menu2. Commented Sep 20, 2015 at 20:14
  • Another thought - if a user's menu contains only content generated by them (that they have authored), you could just remove the "Provide a menu link" option (don't give them access to it) and assign the nodes to menus dynamically on the back end based on author. Of course the drawback here is they wouldn't be able to set a menu item label or weight. It would also require some custom code so if you'd rather not go there I'm at a loss (sorry)... Commented Sep 20, 2015 at 20:30
  • Hi, thanks a lot for the cool ideas!! Especially the second one i will give a try, because the menus should be rather individual. I will post a solution, if I successfully implemented the dynamically menu items per author.
    – mavicc
    Commented Sep 21, 2015 at 6:51

2 Answers 2

1

Check this Menu Per User and let me know if you face any issues.

1

Custom Menu Permissions

This module does two things:

  1. It allows for the permission used to access any menu item on the system to be overridden.
  2. It allows for custom permissions (see hook_permission()) to be created through the admin interface. These permissions can be used the same as any permissions created in a module using hook_permission() - ie in modules, templates, and in hook_menu() callbacks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.