You are here

function forum_node_load in Drupal 7

Implements hook_node_load().

File

modules/forum/forum.module, line 428
Provides discussion forums.

Code

function forum_node_load($nodes) {
  $node_vids = array();
  foreach ($nodes as $node) {
    if (_forum_node_check_node_type($node)) {
      $node_vids[] = $node->vid;
    }
  }
  if (!empty($node_vids)) {
    $query = db_select('forum', 'f');
    $query
      ->fields('f', array(
      'nid',
      'tid',
    ))
      ->condition('f.vid', $node_vids);
    $result = $query
      ->execute();
    foreach ($result as $record) {
      $nodes[$record->nid]->forum_tid = $record->tid;
    }
  }
}