You are here

function nodereference_count_get_vid in Nodereference Count 6

Retrieve the current vid of a node.

Parameters

$nid: the nid of the node being referenced

$vid: the vid of the node being referenced

1 call to nodereference_count_get_vid()
nodereference_count_update_count in ./nodereference_count.module
Update the count of nodereferences to a node when not updating via CCK.

File

./nodereference_count.module, line 196
Defines a field type for counting the references to a node.

Code

function nodereference_count_get_vid($nid, $vid = NULL) {
  static $vids = array();
  if (empty($vid)) {
    if (empty($vids[$nid])) {
      $query = 'SELECT vid FROM {node} WHERE nid = %d';
      $vids[$nid] = db_result(db_query($query, $nid));
    }
  }
  else {
    $vids[$nid] = $vid;
  }
  return $vids[$nid];
}