function mailchimp_admin_settings_submit in Mailchimp 6.2
Same name and namespace in other branches
- 7 mailchimp.admin.inc \mailchimp_admin_settings_submit()
Serialize the saved lists and notify users of the need to rebuild the user's table.
1 string reference to 'mailchimp_admin_settings_submit'
- mailchimp_admin_settings in ./
mailchimp.admin.inc - implementation of hook_admin_settings
File
- ./
mailchimp.admin.inc, line 267
Code
function mailchimp_admin_settings_submit($form, &$form_state) {
// no lists selected or first time here
if (empty($form_state['values']['mailchimp_lists'])) {
return;
}
$required = FALSE;
$lists = array();
foreach ($form_state['values']['mailchimp_lists'] as $form_list) {
$list = new stdClass();
$list->id = $form_list['list_id'];
$list->name = $form_list['name'];
$list->roles = array_filter($form_list['roles']);
$list->description = $form_list['description'];
$list->label = $form_list['label'];
$list->listtype = $form_list['listtype'];
$list->doublein = $form_list['doublein'];
$list->mergevars = $form_list['mergevars'];
$lists[$form_list['list_id']] = $list;
$required = $form_list['listtype'] == MAILCHIMP_LISTTYPE_REQUIRED && $form_state['values']['mailchimp_cron'];
}
// remove lists from the form_state so they are not saved twice
unset($form_state['values']['mailchimp_lists']);
variable_set('mailchimp_lists', $lists);
// let users know they may need to rebuild the user's table
if ($required) {
drupal_set_message(t('At least one list is marked as required and updates are handled via cron. You may need to !rebuild.', array(
'!rebuild' => l('rebuid the MailChimp users table', 'admin/settings/mailchimp/rebuild'),
)));
}
}