| Versions | |
|---|---|
| 4.7 – 7 | node_access_example_node_grants($account, $op) |
Implementation of hook_node_grants().
Since we are restricting access based on a permission, we need to check that permission and return the appropriate result.
developer/
<?php
function node_access_example_node_grants($account, $op) {
$grants = array();
if (user_access('access content', $account)) {
$grants[] = 0;
}
if (user_access('access private content', $account)) {
$grants[] = 1;
}
return array('example' => $grants);
}
?>