Maybe I'm missing something obvious, but, the following function does not do what I want:
<?php
function faq_accesscontrol_node_access($node, $op, $account){
if ($node->type == 'faq'){
$taxonomy_term = $node->field_accesscontrol['und'][0]['taxonomy_term']->name;
// Only restrict access on nodes with 'term_test' as taxonomy term
// and restrict access when taxonomy_term is NOT inside $account->roles
if ($taxonomy_term == 'term_test'&& !in_array($taxonomy_term,$account->roles)){
drupal_set_message(t('Access to node denied for @name', array('@name'=> $account->name)));
return NODE_ACCESS_DENY;
}
}
}
?>
It should deny access when passing the if. And, although it does show the message, access is not denied.
Anyone any idea? Thanks in advance!