You are here

function domain_delete_form_submit in Domain Access 5

Same name and namespace in other branches
  1. 6.2 domain.admin.inc \domain_delete_form_submit()
  2. 7.3 domain.admin.inc \domain_delete_form_submit()
  3. 7.2 domain.admin.inc \domain_delete_form_submit()

FormsAPI for domain_delete_form()

File

./domain_admin.inc, line 652
Administration functions for the domain module.

Code

function domain_delete_form_submit($form_id, $form_values) {

  // Run the lookup before we delete the row!
  $domain = domain_lookup($form_values['domain_id']);
  db_query("DELETE FROM {domain} WHERE domain_id = %d", $form_values['domain_id']);

  // Let other modules act.
  module_invoke_all('domainupdate', 'delete', $domain, $form_values);

  // The user_submitted flag is needed for Domain User.
  if (!$form_values['domain_arguments']['user_submitted']) {
    drupal_set_message(t('Domain record deleted.'));

    // Some tortured logic to return to the root domain and the domain list.
    $default = domain_default();
    $uri = request_uri();
    $_path = explode('/', $uri);
    $_slice = array_slice($_path, 0, -2);
    $path = implode('/', $_slice) . '/view';
    $goto = $default['scheme'] . '://' . $default['subdomain'] . $path;
    drupal_goto($goto);
  }
}