function forum_access_node_insert in Forum Access 7
Same name and namespace in other branches
- 8 forum_access.module \forum_access_node_insert()
Implements hook_node_insert().
1 call to forum_access_node_insert()
- forum_access_node_update in ./
forum_access.module - Implements hook_node_update().
File
- ./
forum_access.module, line 448 - forum_access.module
Code
function forum_access_node_insert($node) {
$old_tid =& drupal_static('forum_access_node_presave');
if (_forum_node_check_node_type($node)) {
if ($tid = _forum_access_get_tid($node)) {
$acl_id = _forum_access_get_acl($tid);
acl_node_add_acl($node->nid, $acl_id, 1, 1, 1);
/*
if (isset($old_tid) && module_exists('nodecomment')) {
$result = db_query('SELECT cid FROM {node_comments} WHERE nid = :nid', array(
':nid' => $node->nid,
));
foreach ($result as $row) {
acl_node_add_acl($row->cid, $acl_id, 1, 1, 1);
node_access_acquire_grants(node_load($row->cid)); //TODO use node_load_multiple() here
}
}
*/
}
$old_tid = NULL;
}
/*
elseif (isset($node->comment_target_nid)) {
// Set moderator on nodecomment.
$topic_node = node_load($node->comment_target_nid);
if (_forum_node_check_node_type($topic_node) && $topic_tid = _forum_access_get_tid($topic_node)) {
$acl_id = _forum_access_get_acl($topic_tid);
acl_node_add_acl($node->nid, $acl_id, 1, 1, 1);
}
}
*/
}