hook_domainupdate($op, $domain = array(), $edit = array())
API.php, line 123
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().
$op The operation being performed: 'create', 'update', 'delete'
$edit The form values processed by the form.
| Name | Description |
|---|---|
| Domain hook functions | Core hooks for the Domain module suite. |
function hook_domainupdate($op, $domain = array(), $edit = 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;
}
}