I have a page that is only accessable by users with a certain role.
I have a menu item that points to that page, but the menu item is not visible to a user with that role.

I understand this is then default behavior inn Drupal6, but I want to hide the page, but enable the menu for EVERYONE.

How do I make it visible to this page?

I have tried the menu_by_role module, but I have not been able to get it to display the menu.

Please help and thanks!

Comments

mikou’s picture

What is the point about giving a link to a page which is not accessible ?
Your users will arrive on a "404 Page not found"...

dalegrebey’s picture

Can you explain what you are trying to accomplish?

  • Only User's with a certain role can access the page
  • Hide the menu that accesses the page to only people who have that role ...
  • Hide the page, but make the menu available to everyone else.

This seems like a non sequitur--I don't follow. What is it that you are trying to accomplish?

yoeld’s picture

Maybe having the menu visible for all visitors is needed for layout/design consideration. Or, just informing the visitor he has not permission for the content and for example, he needs to pay in order to access the information.

In those case, you can create a block for the relevant pages that actually check the permission level. If it is not the one requested, then the visitor will be redirected to another page.

Another solution that is far more simple is to configure the "Default 403 (access denied) page" found at
admin/settings/error-reporting . There you can redirect to the appropriate page with your message.

Hope that is what you are looking for.

teckcrew1’s picture

This is a membership site that has alot of features only available to members. but we want to let people know what they are missing by showing the links to the pages. If they click on the link and they don't have the 'paid member ' role, they are redirected to the 403 page which we have customized to say "you must register first before you are allowed to see that content".

The redirection to the 403 page is working perfectly and I want to keep this very very simple.

The only hurdle I have left is the menu I have pointed to that page is not visible and I want to make it visible. I would think there is a menu permission role that would alalow me to make the menu item visible EVEN if the page behind it should NOT be visible.

I hope that helps clarify and thanks alot for the help.

teckcrew1’s picture

What I am trying to accomplish is to 'tease' a user by showing him a menu, and on when he clicks on it he will see the 'you must purchase a membership before accessing that page' message.

I am looking for the right module to uswe to show the menus to all users.

This seems like a pretty simple problem ansd one that others have had, but I dont know the innards of the menu system to know how to do this...

please help and thanks..

dleong’s picture

subscribing - any suggestions yet?

esavvservices’s picture

Thanks for sharing.Subscribing.

benone’s picture

subscribe

enkara’s picture

subscribing

enkara’s picture

I've found a solution, but I don't know if it's secure enough or if it works for all cases. I've just come to this solution:

I've made an intermediary page that contains the following code. If the user hasn't got the role "somerole" a login form is printed, it doesn't matter if the user is logged in or not (but could be controlled with the php also). If the user belongs to the role then we redirect him to the desired page. That page will be secured by a module as content_access or if it is a view, with the access control of the view itself.

I ask you to tell me any weaknesses you can see in the code!!!! And I hope this helps someone

global $user;
if (!in_array('somerole', $user->roles)){
    print drupal_get_form('user_login_block'); 
}
else {
    drupal_goto('someurl');
}
teckcrew1’s picture

For the help of others who have run into this, here is my final solution.

After exploring alot of different options, we came up with simply making a block and pasting the html that was generated from nice menus inside the block. This way we have full control over the menu. Not dynamic, but easy enough to add and remove menus as I needed to. This solution turned out to work just fine for me.

dalegrebey’s picture

Good work-around.