diff --git a/includes/mailchimp.admin.inc b/includes/mailchimp.admin.inc index f3b5dc3..903b1b9 100644 --- a/includes/mailchimp.admin.inc +++ b/includes/mailchimp.admin.inc @@ -48,7 +48,8 @@ function mailchimp_admin_settings() { '#type' => 'checkbox', '#title' => t('Allow Unsubscribes via Drupal'), '#default_value' => variable_get('mailchimp_allow_unsubscribes', FALSE), - "#description" => t('Simple list subscribe forms may unsubscribe existing users. For most Drupal - Mailchimp integrations only subscribes forms need to be exposed.'), + '#description' => t('Simple list subscribe forms may unsubscribe existing users. For most Drupal - Mailchimp integrations only subscribes forms need to be exposed.'), ); + return system_settings_form($form); } diff --git a/modules/mailchimp_lists/mailchimp_lists.module b/modules/mailchimp_lists/mailchimp_lists.module index 79a09a4..bd35c43 100644 --- a/modules/mailchimp_lists/mailchimp_lists.module +++ b/modules/mailchimp_lists/mailchimp_lists.module @@ -251,7 +251,7 @@ function mailchimp_lists_form_user_register_form_alter(&$form, &$form_state, $fo /** * Implements hook_user_insert(). - * + * * Subscribe new users to optional and required newsletters. */ function mailchimp_lists_user_insert(&$edit, $account, $category) { @@ -350,12 +350,12 @@ function mailchimp_lists_user_sync($account, $old_email = '', $new_email = '', $ /** * Helper function for mailchimp_lists_user_sync(). - * + * * @user $account * @mailchimp_list $list * @email null $new_email * @email null $old_email - * + * * @return array * The mergevars with all values inserted. */ @@ -408,7 +408,7 @@ function mailchimp_lists_freeform_subscribe_page() { /** * Returns a subscription form, or forms, for a given user as a single form. - * + * * If there are multiple lists, this generates a single form for all of them. */ function mailchimp_lists_user_subscribe_form($form, &$form_state, $lists, $account) { @@ -585,9 +585,9 @@ function mailchimp_lists_user_subscribe_form_submit($form, &$form_state) { * Processor for various list form submissions. * * Subscription blocks, user settings, and new user creation. - * + * * @array $list_forms: an array of mailchimp_list form values, as generated - * by mailchimp_lists_list_form() + * by mailchimp_lists_list_form() * @account null $account: the user account to subscribe, if available. * Otherwise, operations will be run with the ['mergevars']['EMAIL'] value. */ @@ -643,15 +643,15 @@ function mailchimp_lists_process_subscribe_form_choices($list_forms, $account = /** * Calls the appropriate API function, or adds to the queue, as appropriate. - * + * * @string $function - 'add', 'remove', or 'update'. Matches Queue operations. - * @mailchimp_lists $list - the list to update + * @mailchimp_lists $list - the list to update * @string $mail - email address to update on the list * @array $mergevars - merge variables array formatted for mailchimp API * @account null $account - account that $mail came from, if non-anonymous call * @mcapi_entity null &$mcapi - api object if loaded, to avoid extra API calls * @queue null &$queue - the cron queue. If passed, this will force use of cron. - * + * * @return * Indicates whether the operation was successful. */ @@ -682,13 +682,14 @@ function mailchimp_lists_execute_change($function, $list, $mail, $mergevars = NU break; case 'remove': - if(variable_get('mailchimp_allow_unsubscribes', FALSE)) { - $ret = mailchimp_unsubscribe_user($list, $mail, TRUE, $mcapi); - } - else { - drupal_set_message(t('You are already subscribed to this list.', array())); - $ret = 1; - } + if (variable_get('mailchimp_allow_unsubscribes', FALSE)) { + $ret = mailchimp_unsubscribe_user($list, $mail, TRUE, $mcapi); + } + else { + $label = isset($list->settings['form_label']) ? t($list->settings['form_label']) : $list->label(); + drupal_set_message(t('You are already subscribed to %label.', array('%label' => $label))); + $ret = 1; + } break; case 'update': @@ -743,7 +744,7 @@ function mailchimp_lists_mailchimp_lists_merge_tokens() { /** * Get the relevant merge vars for the given user for the given list. - * + * * @account $account * @mailchimp_list $list * @array null $interest_groups @@ -976,7 +977,7 @@ function mailchimp_lists_forms($form_id, $args) { * Queue existing users in a list. Optionally, queue users to remove. * * @mailchimp_list $list - * + * * @boolean $queue_removals * If set to TRUE, will queue anyone who should be removed from the list. * diff --git a/modules/mailchimp_lists/mailchimp_lists.rules.inc b/modules/mailchimp_lists/mailchimp_lists.rules.inc index 8fa5b0a..a051fe5 100644 --- a/modules/mailchimp_lists/mailchimp_lists.rules.inc +++ b/modules/mailchimp_lists/mailchimp_lists.rules.inc @@ -95,7 +95,7 @@ function mailchimp_lists_rules_action_user_subscribe_list($account, $list) { * Action callback: Unsubscribe a user to a list. */ function mailchimp_lists_rules_action_unsubscribe_list($mail, $list) { - if(variable_get('mailchimp_allow_unsubscribes', FALSE)) { + if (variable_get('mailchimp_allow_unsubscribes', FALSE)) { mailchimp_unsubscribe_user($list, $mail, FALSE); } }