You are here

function regcode_tag_action in Registration codes 7

Same name and namespace in other branches
  1. 6.2 regcode.module \regcode_tag_action()
  2. 7.2 regcode.module \regcode_tag_action()

Regcode tag action.

File

./regcode.module, line 695
Main functionality and hooks of regcode module.

Code

function regcode_tag_action(&$object, $context = array()) {

  // Apply terms.
  foreach ($context['apply_terms'] as $term) {
    $record = array(
      'rid' => $object->rid,
      'tid' => $term,
    );
    db_merge('regcode_term')
      ->key($record)
      ->fields($record)
      ->execute();
  }

  // Remove terms.
  foreach ($context['remove_terms'] as $term) {
    db_delete('regcode_term')
      ->condition('rid', $object->rid)
      ->condition('tid', $term)
      ->execute();
  }
}