You are here

function hook_domain_reassign in Domain Access 7.3

Allows content or users to be reassigned to a new domain.

Parameters

$old_domain: The current domain record, most commonly passed during a domain deletion.

$new_domain: The target domain record.

$table: The database table being affected. This value indicates the type of update being performed. Core module values are 'domain_access' (indicating that node records are being affected, and 'domain_editor' (indicating user records).

Return value

No return value.

2 functions implement hook_domain_reassign()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

domain_source_domain_reassign in domain_source/domain_source.domain.inc
Implements hook_domain_reassign().
domain_test_domain_reassign in tests/domain_test.domain.inc
Implements hook_domain_reassign().
1 invocation of hook_domain_reassign()
domain_reassign in ./domain.module
Reassign domain data to a new domain.

File

./domain.api.php, line 848
API documentation file.

Code

function hook_domain_reassign($old_domain, $new_domain, $table) {

  // On node changes, update {domain_source}.
  if ($table == 'domain_access') {
    db_update('domain_source')
      ->fields(array(
      'domain_id' => $new_domain['domain_id'],
    ))
      ->condition('domain_id', $old_domain['domain_id'])
      ->execute();
  }
}