nodefamily_relation_load_all_nids

Versions
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

▾ 1 function calls nodefamily_relation_load_all_nids()

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

contributions/nodefamily/nodefamily.module, line 546

<?php
function nodefamily_relation_load_all_nids(&$node) {

  if (!is_object($node)) {
    //$node is the nid
    $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;
}
?>

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.