I find the restricted contents can still be seen on the rss and the nodes page.
So I did something to hide them.
I implemented hook_node_access_records() and hook_node_grants()
Here are the codes.
/**
* Implementation of hook_node_access_records().
*/
function restrict_content_node_access_records($node) {
if (isset($node->restrict_content_roles)) {
foreach ($node->restrict_content_roles as $rid => $role) {
if ($role) {
$grants[] = array(
'realm' => 'restrict_content',
'gid' => $rid,
'grant_view' => 1,
'grant_update' => 0,
'grant_delete' => 0,
'priority' => 0,
);
}
}
}
return $grants;
}
/**
* Implementation of hook_node_grants().
*/
function restrict_content_node_grants($ac, $op) {
foreach ($ac->roles as $rid => $role) {
$grants['restrict_content'] = array($rid);
}
return $grants;
}
Comments
Comment #1
bobooon commentedProject has been discontinued in favor of https://www.drupal.org/project/content_access.