I am still unable to understand what hook_node_access()
does.
I am trying to give view access to the Basic content type nodes to anonymous users, but the code I wrote doesn’t work, as anonymous users still get an access denied error.
function modules_session_node_access($node,$op,$account) {
$type = is_string($node) ? $node : $node->type;
$is_anonymous = !user_is_logged_in();
if ($op == 'view' && $is_anonymous && $type='basic') {
return NODE_ACCESS_ALLOW;
}
return NODE_ACCESS_IGNORE;
}
Why doesn’t that code allow anonymous users to view the Basic nodes?