0

I forbid content access to all user that are not connected. The problem is that Drupal prevent also the access of the main page (And I want that an anonymous user will be able to see it..). How can I separate the main page access to the other content of the site ?

Thank you

2

This question was asked on the Drupal forums here.

If your frontpage is a node you can control access using the Content Access module.

If your frontpage is being generated by a custom module then you can do it by modifying the hook_menu implementation in your module. You can change the access_callback to the value TRUE so that everyone can access that page. See this related question

"access callback": A function returning TRUE if the user has access rights to this menu item, and FALSE if not. It can also be a boolean constant instead of a function, and you can also use numeric values (will be cast to boolean). Defaults to user_access() unless a value is inherited from the parent menu item; only MENU_DEFAULT_LOCAL_TASK items can inherit access callbacks. To use the user_access() default callback, you must specify the permission to check as 'access arguments' (see below).

See the full documentation here.

  • Thank you but the "problem" is that my home page is hard coded.. (the homepage presents all site functionality) and thus, this module is not suitable to me. My search is more to permission api or something like that direction – Eliel Haouzi Dec 5 '13 at 20:31
  • Oh, that makes it a different problem. I added more info. – Thomas4019 Dec 5 '13 at 20:43
0

Another route is to use Panels (1) in combination with views (2), which allows you to create a different frontpage lay-out depending on the role, so also for the role anonymous (not logged in users).

(1) https://drupal.org/project/panels (2) https://drupal.org/project/views

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.