You are here

function swftools_profiles_delete_confirm_submit in SWF Tools 6.3

Processes profile deletion.

File

profiles/swftools_profiles.admin.inc, line 473
Configuration settings for SWF Tools profiles.

Code

function swftools_profiles_delete_confirm_submit($form, &$form_state) {

  // TODO: When we delete a profile we should account for profiles that might be using it
  // Delete any settings associated with this profile
  foreach (swftools_profiles_settings() as $setting) {
    if (($settings = variable_get(swftools_profiles_variable_name($setting, $form_state['values']['profile']), SWFTOOLS_UNDEFINED)) != SWFTOOLS_UNDEFINED) {
      variable_del(swftools_profiles_variable_name($setting, $form_state['values']['profile']));
    }
  }

  // Execute the delete
  db_query("DELETE FROM {swftools_profiles} WHERE profile = '%s'", $form_state['values']['profile']);

  // Generate a message
  $t_args = array(
    '%name' => $form_state['values']['name'],
  );
  drupal_set_message(t('The profile %name has been deleted.', $t_args));
  watchdog('swftools', 'Deleted profile %name.', $t_args, WATCHDOG_NOTICE);

  // Redirect back to profile list
  $form_state['redirect'] = 'admin/settings/swftools/profiles';

  // Done
  return;
}