Undefined index first_name, last_name
-
Here’s a patch:
From 6b26b8dd44ee87b3cd97434694f7adccedd98862 Mon Sep 17 00:00:00 2001 From: Kristoffer LR <[email protected]> Date: Fri, 5 Sep 2014 16:03:06 -0400 Subject: [PATCH] Fix undefined index errors relative to optionnal first and last name. --- lib/ns_widget_mailchimp.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ns_widget_mailchimp.class.php b/lib/ns_widget_mailchimp.class.php index bbef5f4..3129f75 100644 --- a/lib/ns_widget_mailchimp.class.php +++ b/lib/ns_widget_mailchimp.class.php @@ -191,14 +191,16 @@ class NS_Widget_MailChimp extends WP_Widget { return false; } + + $merge_vars = array(); - if (is_string($_POST[$this->id_base . '_first_name']) && '' != $_POST[$this->id_base . '_first_name']) { + if (!empty($_POST[$this->id_base . '_first_name']) && is_string($_POST[$this->id_base . '_first_name'])) { $merge_vars['FNAME'] = strip_tags($_POST[$this->id_base . '_first_name']); } - if (is_string($_POST[$this->id_base . '_last_name']) && '' != $_POST[$this->id_base . '_last_name']) { + if (!empty($_POST[$this->id_base . '_last_name']) && is_string($_POST[$this->id_base . '_last_name'])) { $merge_vars['LNAME'] = strip_tags($_POST[$this->id_base . '_last_name']); -- 1.8.5.2
- The topic ‘Undefined index first_name, last_name’ is closed to new replies.