You are here

function mailchimp_campaign_delete_campaign in Mailchimp 7.2

Same name and namespace in other branches
  1. 8 modules/mailchimp_campaign/mailchimp_campaign.module \mailchimp_campaign_delete_campaign()
  2. 7.5 modules/mailchimp_campaign/mailchimp_campaign.module \mailchimp_campaign_delete_campaign()
  3. 7.3 modules/mailchimp_campaign/mailchimp_campaign.module \mailchimp_campaign_delete_campaign()
  4. 7.4 modules/mailchimp_campaign/mailchimp_campaign.module \mailchimp_campaign_delete_campaign()
  5. 2.x modules/mailchimp_campaign/mailchimp_campaign.module \mailchimp_campaign_delete_campaign()

Delete a MailChimp campaign and the local entity.

1 call to mailchimp_campaign_delete_campaign()
mailchimp_campaign_delete_form_submit in modules/mailchimp_campaign/mailchimp_campaign.admin.inc
Submit handler for mailchimp_campaign_delete_list_form();

File

modules/mailchimp_campaign/mailchimp_campaign.module, line 284

Code

function mailchimp_campaign_delete_campaign($cid) {
  $mcapi = mailchimp_get_api_object();

  // Delete campaign from MailChimp
  $delete = $mcapi
    ->campaignDelete($cid);
  if ($mcapi->errorCode) {

    // Display and log error, if any.
    $message = 'MailChimp error. The campaign was not deleted.';
    _mailchimp_campaign_mcapi_error_message($mcapi, $message);
  }
  else {

    // Delete campaign from the database
    mailchimp_campaign_delete($cid);
    watchdog('mailchimp_campaign', 'MailChimp campaign %cid was deleted.', array(
      '%cid' => $cid,
    ));
  }
}