0

I would like to prevent anonymous users from accessing any of the taxonomy pages on my site.

I am already using the Panels module to provide variants for each vocabulary, and these variants have access rules limiting them to authenticated users only. However, anonymous users can still access the default taxonomy pages provided by Drupal.

I thought about adding a new variant (301 redirect) and forcing anonymous users to the front page-- is there a better solution?

2 Answers 2

5

Don't need to force using panels.

Having better solution to set permission for your taxonomy pages by code.

Default taxonomy page permission is 'Access content'.

Override that permission in your own by custom module.

Using hook_menu_alter() to change permission

Sample:

function [MODULENAME]_menu_alter(&$items) {
  $items['taxonomy/term/%']['access arguments'] = array('custom permission');
}

Set that custom permission in your hook_perm().

sample :

function [MODULENAME]_perm() {
  return array('custom permission');
}

Clear your site cache once.

Then Goto admin/user/permissions

Set permission by role.

0

This video tutorial will show you how to hide pages from anonymous using panels

https://www.youtube.com/watch?v=cE14tLom8W8

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.