nodefamily_relation_load_all_nids
contributions/nodefamily/nodefamily.module, line 546
- 5
nodefamily_relation_load_all_nids(&$node)
Load all children's nids for a node. This function doesn't obey node_access
for the current user, it just loads all children.
The children's node-ids will be loaded into the array $node->children.
Parameters
$node The node object or the node's id
Related topics
- Implementation of node - node relation API
- nodefamily_relation_load_all_nids in contributions/nodefamily/nodefamily.module
- Load all children's nids for a node. This function doesn't obey node_access
for the current user, it just loads all children.
The children's node-ids will be loaded into the array $node->children.
Code
<?php
function nodefamily_relation_load_all_nids(&$node) {
if (!is_object($node)) {
$node2 = node_load($node);
return is_object($node2) ? nodefamily_relation_load_all_nids($node2) : FALSE;
}
$result = db_query("SELECT child_nid FROM {nodefamily} WHERE parent_nid = %d", $node->nid);
$node->children = array();
while ($row = db_fetch_object($result)) {
$node->children[$row->child_nid] = $row->child_nid;
}
return $node->children;
}
?>