You are here

function tweet_feed_delete_account_form_submit in Tweet Feed 7.3

Same name and namespace in other branches
  1. 7.2 tweet_feed_admin.inc \tweet_feed_delete_account_form_submit()

Delete account callback form

File

./tweet_feed_admin.inc, line 609

Code

function tweet_feed_delete_account_form_submit($form, &$form_state) {
  $aid = $form_state['values']['aid'];
  if (!empty($aid)) {
    $number_deleted = db_delete('tweet_accounts')
      ->condition('aid', $aid)
      ->execute();
    if ($number_deleted > 0) {
      drupal_set_message('You have successfully deleted the selected account.', 'status');
      $form_state['redirect'] = 'admin/config/services/tweet_feed/accounts';
    }
    else {
      drupal_set_message('The selected account could not be deleted.', 'error');
      $form_state['redirect'] = 'admin/config/services/tweet_feed/accounts';
    }
  }
  else {
    drupal_set_message('There was an internal error and the request could not be processed.', 'error');
    $form_state['redirect'] = 'admin/config/services/tweet_feed/accounts';
  }
}