Skip to content

If no list is selected, the form still shows but doesn't work correctly #53

@dkotter

Description

@dkotter

Describe the bug

While testing #51 (see #51 (comment)) I ran into an issue in the following scenario:

  1. Either sign in with a new account or create a new account
  2. On the settings screen, verify no List is selected (should show -- Select A List --
  3. Create a new page and add the Mailchimp block to it
  4. Verify the form shows correctly on the front-end
  5. Try and submit the form with no information or with valid information
  6. If debug is on, you should get the following PHP warning: Undefined array key "field" in /mailchimp/lib/mailchimp/mailchimp.php on line 193

If I debug the response from the request, this is what I get:

{
["type"]=> string(54) "https://mailchimp.com/developer/marketing/docs/errors/"
["title"]=> string(18) "Resource Not Found"
["status"]=> int(404)
["detail"]=> string(42) "The requested resource could not be found."
["instance"]=> string(36) "redacted"
}

I think we can add better defensive programming here to ensure the value we want exists before we try and use it. But would also be ideal in this scenario to not allow the form at all if no valid list has been selected.

Steps to Reproduce

No response

Screenshots, screen recording, code snippet

No response

Environment information

No response

WordPress information

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions