You are here

function domain_rules_actions_delete_domain in Domain Rules 7

Custom hook Do on action 'delete domain'

Parameters

string $subdomain:

File

./domain_rules.module, line 127
domain_rules.module @description Port of 'Domain rules' by shushu for Drupal7

Code

function domain_rules_actions_delete_domain($subdomain) {
  $domain = domain_lookup(NULL, $subdomain, TRUE);
  if ($domain['domain_id']) {
    domain_delete($domain);
    $domain = domain_lookup(NULL, $subdomain, TRUE);
    if ($domain['domain_id']) {
      drupal_set_message(t('Failed to delete the domain %domain.', array(
        '%domain' => $subdomain,
      )), 'error');
    }
    else {
      drupal_set_message(t('The domain %domain deleted successfully.', array(
        '%domain' => $subdomain,
      )));
    }
  }
  else {
    drupal_set_message(t('The domain %domain does not exist.', array(
      '%domain' => $subdomain,
    )), 'error');
  }
}