function view_unpublished_node_access_records in view_unpublished 7
Same name and namespace in other branches
- 8 view_unpublished.module \view_unpublished_node_access_records()
Implements hook_node_access_records().
File
- ./
view_unpublished.module, line 31 - Main functions and hook implementations of the View Unpublished module.
Code
function view_unpublished_node_access_records($node) {
// We only care about the node if is unpublished. If not, it is
// treated just like any other node and we completely ignore it.
if ($node->status == 0) {
$grants = array();
// Unpublished nodes should be viewable to all editors.
$grants[] = array(
'realm' => 'view_unpublished_content',
'gid' => 1,
'grant_view' => 1,
'grant_update' => 0,
'grant_delete' => 0,
'priority' => 0,
);
$grants[] = array(
'realm' => 'view_unpublished_' . $node->type . '_content',
'gid' => 1,
'grant_view' => 1,
'grant_update' => 0,
'grant_delete' => 0,
'priority' => 0,
);
$grants[] = array(
'realm' => 'view_unpublished_author',
'gid' => $node->uid,
'grant_view' => 1,
'grant_update' => 0,
'grant_delete' => 0,
'priority' => 0,
);
return $grants;
}
}