0

Is there a simple way that I can forcibly allow everybody to view all teasers no matter what, overriding any other permissions set by Content Access, etc.

I was thinking something like this:

function mymodule_node_access($node, $op, $account) {
  if( $op == 'view' && ... viewing teaser ) {
    return NODE_ACCESS_ALLOW;
  }
  return NODE_ACCESS_IGNORE;
}

and then I would set the module weight really high. But I'm not sure how to check if viewing teaser. I would also need Views to respect the access I'm granting.

0

This is not possible in hook_node_access, Drupal does not allow for this so easily. Instead, you could use module Premium Content (https://drupal.org/project/premium_content) and do this in configuration.

Btw., this question has already been answered: Show teasers to anonymous visitors but not allow access to the body/node

Your Answer

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