function domain_user_domainupdate in Domain Access 5
Same name and namespace in other branches
- 6.2 domain_user/domain_user.module \domain_user_domainupdate()
Implement hook_domainupdate()
File
- domain_user/
domain_user.module, line 351 - Creates unique subdomains for registered users.
Code
function domain_user_domainupdate($op, $domain = array(), $edit = array()) {
$root = variable_get('domain_user_root', variable_get('domain_root', ''));
switch ($op) {
case 'update':
// If these are different, then we must delete a row from {access}.
if ($domain['subdomain'] != $edit['subdomain']) {
$mask = str_replace('.' . $root, '', $domain['subdomain']);
db_query("DELETE FROM {access} WHERE mask = '%s'", $mask);
}
domain_user_rules();
break;
case 'delete':
// Delete from {domain_user}
db_query("DELETE FROM {domain_user} WHERE domain_id = %d", $domain['domain_id']);
// Delete from the access rules.
$user_root = variable_get('domain_user_root', variable_get('domain_root', ''));
$mask = str_replace('.' . $user_root, '', $domain['subdomain']);
db_query("DELETE FROM {access} WHERE mask = '%s'", $mask);
break;
}
}