Skip to content

Commit 0734101

Browse files
committed
Show an error message and return early if no list is chosen
1 parent 59f6369 commit 0734101

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

mailchimp.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,12 @@ function mailchimp_sf_save_general_form_settings() {
634634
* Sees if the user changed the list, and updates options accordingly
635635
**/
636636
function mailchimp_sf_change_list_if_necessary() {
637+
if ( empty( $_POST['mc_list_id'] ) ) {
638+
$msg = '<p class="error_msg">' . esc_html( __( 'Please choose a valid list', 'mailchimp_i18n' ) ) . '</p>';
639+
mailchimp_sf_global_msg( $msg );
640+
return;
641+
}
642+
637643
// Simple permission check before going through all this
638644
if ( ! current_user_can( MCSF_CAP_THRESHOLD ) ) { return; }
639645

@@ -649,7 +655,7 @@ function mailchimp_sf_change_list_if_necessary() {
649655

650656
$lists = $lists['lists'];
651657

652-
if ( is_array( $lists ) && ! empty( $lists ) && isset( $_POST['mc_list_id'] ) ) {
658+
if ( is_array( $lists ) && ! empty( $lists ) ) {
653659

654660
/**
655661
* If our incoming list ID (the one chosen in the select dropdown)

0 commit comments

Comments
 (0)