You are here

function mailchimp_webhook_delete in Mailchimp 7.3

Same name and namespace in other branches
  1. 8 mailchimp.module \mailchimp_webhook_delete()
  2. 7.5 mailchimp.module \mailchimp_webhook_delete()
  3. 7.4 mailchimp.module \mailchimp_webhook_delete()
  4. 2.x mailchimp.module \mailchimp_webhook_delete()

Wrapper around MCAPI->lists->webhookDel().

Return value

bool TRUE if deletion was successful, otherwise FALSE.

2 calls to mailchimp_webhook_delete()
MailchimpListsTestCase::testDeleteWebhook in modules/mailchimp_lists/tests/mailchimp_lists.test
Tests deletion of a webhook.
mailchimp_lists_webhook_form_submit in modules/mailchimp_lists/includes/mailchimp_lists.admin.inc
Submit handler for mailchimp_lists_webhook_form().

File

./mailchimp.module, line 1058
Mailchimp module.

Code

function mailchimp_webhook_delete($list_id, $url) {
  try {
    $mcapi = mailchimp_get_api_object();
    if (!$mcapi) {
      throw new MailchimpException('Cannot delete webhook without MailChimp API. Check API key has been entered.');
    }
    $result = $mcapi->lists
      ->webhookDel($list_id, $url);
  } catch (Exception $e) {
    watchdog('mailchimp', 'An error occurred deleting webhook for list @list. "%message"', array(
      '@list' => $list_id,
      '%message' => $e
        ->getMessage(),
    ), WATCHDOG_ERROR);
    return FALSE;
  }
  return $result['complete'];
}