hook_domainupdate

Versions
domain
hook_domainupdate($op, $domain, $form_state = array())

Notify other modules that we have created a new domain or updated a domain record.

For 'update' and 'delete' operations, the $domain array holds the original values of the domain record. The $edit array will hold the new, replacement values. This is useful when making changes to records, such as in domain_user_domainupdate().

Parameters

$op The operation being performed: 'create', 'update', 'delete'

$domain The domain record taken from {domain}, as an array.

$form_state The form values processed by the form. Note that these are not editable since module_invoke_all() cannot pass by reference. We set $form_state to an array by default in case this hook gets called by a non-form function.

Related topics

Code

./API.php, line 125

<?php
function hook_domainupdate($op, $domain, $form_state = array()) {
  switch ($op) {
    case 'create':
      db_query("INSERT INTO {mytable} (subdomain, sitename) VALUES ('%s', '%s')", $domain['subdomain'], $domain['sitename']);
      break;
    case 'update':
      db_query("UPDATE {mytable} SET subdomain = '%s', sitename = '%s' WHERE domain_id = %d", $domain['subdomain'], $domain['sitename'], $domain['domain_id']);
      break;
    case 'delete':
      db_query("DELETE FROM {mytable} WHERE subdomain = '%s'", $domain['subdomain']);
      break;
  }
}
?>

Contact

  • agentrickard [at] gmail [dot] com

Donations

My Amazon.com Wish List