2

How can I remove the some links from the Tab, when we are login as a particular user. Please see the below picture. I want to remove the tab Items maked in red rectangle (deny access to this link). enter image description here

I tried with hook_menu_alter, but it do not worked and also understood, hook_menu_alter only hide the item in the tab. Please give me a solution. I am using drupal 7 version

Please note: I am using node gallery module to this content type to attach gallery with a node. I have added roles & assigned role to a particular user. Also give permission form that this content type in permission tab. The problem is that, when we logged as user, only the edit link is disappearing, not the gallery attached with it. I want to set this in page wise. The same user want to edit the gallery in some page & also want to edit the node. I used simple access module, but no use. it only remove the edit of that page, not the gallery attached with it. I also tried hook_node_access(). For that also the same result. Please give any solution.

Please see: node gallery permission is separate, which is not connected with a content type. I need to deny below url based on the roles. 1) node/#/items, 2) node/#/upload 3) node/#/sort

enter image description here

  • Please add all the info you posted as comments under my answer directly to your question. It would be a waste of time if someone answered in a way that does not satisfy you and only after discovered that his answer is not applicable due to requirements you knew, but omitted in question. – Mołot Jul 10 '14 at 8:47
  • Looking at the permissions screenshot, it seems that you've configured all authenticated roles to be able to see the tabs except administrator (which seems a bit weird!). Which role shouldn't be able to see the tabs? (Btw I've just looked at node gallery's hook_menu() and it seems this should all be possible via permissions unless I've missed something.) – Andy Jul 10 '14 at 10:36
  • Andy, I need to give permission to different nodes of same content type based on the role. So I need to check those. – Shino Jul 10 '14 at 11:42
  • I need to deny below url based on the roles. 1) node/*/items 2) node/*/upload 3) node/*/sort. – Shino Jul 10 '14 at 11:48
  • IIUC you want to remove the node gallery tabs Sort Items, Manage Items, and Upload New Items for certain roles. These tabs should only be shown if the role has the appropriate permission. So if you can say which role shouldn't be able to see the tabs, I can help debugging based on the permissions screenshot. – Andy Jul 10 '14 at 11:54
0

You can give permissions to menu links according to role.give permission to the above links then they will appear as per according to roles. use the below given module for permissions as per role

Menu per Role

May this will help you.

  • Please note: this is not menu, this is a tab in a page. actually I printing tab (print render($tabs)) in the page.tpl.php – Shino Jul 10 '14 at 9:37
  • @Shino tabs are menu local tasks in Drupal (usually) – Mołot Jul 10 '14 at 9:52
  • only drupal 6 version Menu per Role is available. – Shino Jul 10 '14 at 10:17
  • you can use dev version of it – TBI Infotech Jul 10 '14 at 11:08
0

As I understand it, you'd like the following behaviour:

  • if a user with the flexi role is looking at their own gallery, they see the three tabs;
  • when looking at someone else's gallery, the flexi user can't see the three tabs.

I believe you can do it with permissions. The flexi role:

  • needs: TYPE: Create new content, TYPE: Edit own content
  • mustn't have: Administer content, Administer Node Gallery Settings, Upload to All Galleries, TYPE: Edit any content

Replace TYPE with the node gallery content type(s) that flexi users can create.

  • Andy, It is a live project. Also already contents are created & need to give permission to the same content type, based on role – Shino Jul 14 '14 at 15:02
  • @Shino I'm sorry I don't really understand :/ If your site is live, I'd definitely suggest ensuring the permissions are appropriate (eg. from your screenshot flexi users can administer node gallery settings, which from your comments you clearly don't want!). – Andy Jul 14 '14 at 15:34
  • Andy, I am sorry. you didn't understand my requirement. – Shino Jul 15 '14 at 3:47
  • @Shino So the description of your requirement at the beginning of my answer is incorrect? Or maybe incomplete? – Andy Jul 15 '14 at 9:19
  • Yes. The problem is that I was not able to describe my requirement properly. – Shino Jul 16 '14 at 6:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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