You are here

function og_vocab_write_record in OG Vocabulary 6

API function; Insert or update a record to the {og_vocab} table.

Parameters

$nid: The node id of the group.

$vid: The vocabulary id.

2 calls to og_vocab_write_record()
og_vocab_rules_action_assign_vocab in ./og_vocab.rules.inc
Action: Assign vocabulary to group.
og_vocab_taxonomy in ./og_vocab.module
Implementation of hook_taxonomy().

File

./og_vocab.module, line 396
Give each group its own system controlled vocabularies.

Code

function og_vocab_write_record($nid, $vid) {
  $record = array(
    'nid' => $nid,
    'vid' => $vid,
  );
  if (!og_vocab_get_group($vid)) {

    // Insert a new record.
    drupal_write_record('og_vocab', $record);
  }
  else {

    // Update an existing record.
    drupal_write_record('og_vocab', $record, array(
      'vid',
    ));
  }
}