# Problem/Motivation

I get the following error Notice: Undefined index: gdpr_consent in Drupal\mailchimp_signup\Form\MailchimpSignupPageForm->buildForm() when someone is subscribing by the mailchimp sign up form.

# Proposed solution

Check the existance of the gdrp_consent before using it.

Comments

unstatu created an issue. See original summary.

unstatu’s picture

Status: Active » Needs review
StatusFileSize
new1.32 KB
ki’s picture

Cleaned up the patch to work with 1.x-dev#e23d397

mrinalini9’s picture

Rerolled patch #3 for 8.x-1.x as it failed to apply, please review.

agoradesign’s picture

works for me :) btw, 1.11 users still need the patch from #2, the latest is for dev

brendanthinkshout’s picture

StatusFileSize
new1.93 KB

Needs an official community review ruling if you're up for providing that, @agoradesign. Tweaked the patch from #4 because I don't think we're at a place where we can always use the PHP7 null coalescing operator yet.

gcb’s picture

Assigned: Unassigned » 5adiyah
devad’s picture

This error message appeared to me after update from previous 8.x-1.x-dev to 2.0.0-rc1.

I have applied this change from patch #6 manually and it fixed error message for me:

@@ -228,7 +228,7 @@ class MailchimpSignupPageForm extends FormBase {
       }
 
       // Include the GDPR consent checkbox if necessary.
-      if (isset($this->signup->settings['gdpr_consent']) && $this->signup->settings['gdpr_consent']) {
+      if (!empty($this->signup->settings['gdpr_consent'])) {
         $form['mailchimp_lists']['gdpr_consent'] = [
           '#type' => 'checkbox',
           '#default_value' => FALSE,
devad’s picture

Version: 8.x-1.x-dev » 2.x-dev

  • gcb committed 46a79aa on 2.x
    Issue #3102045 by unstatu, mrinalini9, brendanthinkshout, Ki: Notice:...
gcb’s picture

Status: Needs review » Fixed

This can also be fixed by re-saving the settings for your signup form, if anyone is unable to patch or update.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.