function mailchimp_lists_webhook_form_submit in Mailchimp 7.4
Same name and namespace in other branches
- 7.5 modules/mailchimp_lists/includes/mailchimp_lists.admin.inc \mailchimp_lists_webhook_form_submit()
- 7.3 modules/mailchimp_lists/includes/mailchimp_lists.admin.inc \mailchimp_lists_webhook_form_submit()
Submit handler for mailchimp_lists_webhook_form().
File
- modules/
mailchimp_lists/ includes/ mailchimp_lists.admin.inc, line 147 - mailchimp_lists module admin settings.
Code
function mailchimp_lists_webhook_form_submit($form, &$form_state) {
$list_id = $form_state['list']->id;
switch ($form_state['action']) {
case 'enable':
$result = mailchimp_webhook_add($list_id, mailchimp_webhook_url(), array(
'unsubscribe' => TRUE,
'profile' => TRUE,
'cleaned' => TRUE,
'upemail' => TRUE,
), array(
'user' => TRUE,
'admin' => TRUE,
'api' => FALSE,
));
break;
case 'disable':
$result = mailchimp_webhook_delete($list_id, mailchimp_webhook_url());
break;
default:
$result = FALSE;
break;
}
if ($result) {
drupal_set_message(t('Webhooks for list "%name" have been %action.', array(
'%name' => $form_state['list']->name,
'%action' => $form_state['action'] . 'd',
)));
}
else {
drupal_set_message(t('Unable to perform webhook action "%action" for list "%name".', array(
'%name' => $form_state['list']->name,
'%action' => $form_state['action'],
)), 'warning');
}
$form_state['redirect'] = 'admin/config/services/mailchimp/lists';
}