diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 9985810..65c8ffa 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -24,7 +24,7 @@ jobs: matrix: core: - {name: 'WP latest', version: 'latest'} - - {name: 'WP minimum', version: 'WordPress/WordPress#6.1'} + - {name: 'WP minimum', version: 'WordPress/WordPress#6.3'} - {name: 'WP trunk', version: 'WordPress/WordPress#master'} steps: diff --git a/CHANGELOG.md b/CHANGELOG.md index 344d346..e0419ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,19 @@ All notable changes to this project will be documented in this file, per [the Ke ## [Unreleased] - TBD +## [1.6.2] - 2024-11-12 +**Note that this release bumps the WordPress minimum version from 6.1 to 6.3.** + +### Changed +- Bump WordPress "tested up to" version 6.7 (props [@qasumitbagthariya](https://github.com/qasumitbagthariya), [@vikrampm1](https://github.com/vikrampm1), [@dkotter](https://github.com/dkotter) via [#71](https://github.com/mailchimp/wordpress/pull/71)). +- Bump WordPress minimum supported version from 6.1 to 6.3 (props [@qasumitbagthariya](https://github.com/qasumitbagthariya), [@vikrampm1](https://github.com/vikrampm1), [@dkotter](https://github.com/dkotter) via [#71](https://github.com/mailchimp/wordpress/pull/71)). + +### Fixed +- Ensure the field name is properly added to the error message when the email address is blank (props [@iamdharmesh](https://github.com/iamdharmesh), [@jerclarke](https://github.com/jerclarke), [@dkotter](https://github.com/dkotter) via [#74](https://github.com/mailchimp/wordpress/pull/74)). + +### Developer +- Remove the Advanced Section from our readme files (props [@iamdharmesh](https://github.com/iamdharmesh), [@dkotter](https://github.com/dkotter) via [#77](https://github.com/mailchimp/wordpress/pull/77)). + ## [1.6.1] - 2024-10-14 ### Changed - Improved migration flow from API Key to OAuth authentication for a better user experience (props [@iamdharmesh](https://github.com/iamdharmesh), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter), [@qasumitbagthariya](https://github.com/qasumitbagthariya) via [#67](https://github.com/mailchimp/wordpress/pull/67)). @@ -179,5 +192,6 @@ All notable changes to this project will be documented in this file, per [the Ke - Security and various other improvements [Unreleased]: https://github.com/mailchimp/wordpress/compare/main...develop +[1.6.2]: https://github.com/mailchimp/wordpress/compare/1.6.1...1.6.2 [1.6.1]: https://github.com/mailchimp/wordpress/compare/1.6.0...1.6.1 [1.6.0]: https://github.com/mailchimp/wordpress/tree/1.6.0 diff --git a/CREDITS.md b/CREDITS.md index f7be5be..5d1bb25 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -12,7 +12,7 @@ The following individuals are responsible for curating the list of issues, respo Thank you to all the people who have already contributed to this repository via bug reports, code, design, ideas, project management, translation, testing, etc. -[Mailchimp (@mailchimp)](https://github.com/mailchimp), [Crowd Favorite (@crowdfavorite)](https://github.com/crowdfavorite), [Matthew Richmond (@bigdawggi)](https://github.com/bigdawggi), [Devin Reams (@devinreams)](https://github.com/devinreams), [Alex King (@alexkingorg)](https://github.com/alexkingorg), [Jesse (@jessedp)](https://github.com/jessedp), [Andrew Ellis](awellis@me.com), [Evan Anderson (@ejdanderson)](https://github.com/ejdanderson), [Webb Henderson (@emerywebster)](https://github.com/emerywebster), [Steven Mathias (@ssmathias)](https://github.com/ssmathias), [Jonathan D. Johnson (@jondavidjohn)](https://github.com/jondavidjohn), [Ross Tweedie (@digitales)](https://github.com/digitales), [(@mcwill)](https://github.com/mcwill), [Andrew Austin (@andrewjaustin)](https://github.com/andrewjaustin), [Marc Queralt i Bassa (@MarcQueralt)](https://github.com/MarcQueralt), [Chris Mospaw (@mospaw)](https://github.com/mospaw), [Jonas Stensved (@jstensved)](https://github.com/jstensved), [netboy](netboy@netboy.pl), [Lenin](lenin@tasawr.com), [Bauke Zwaan (@baukezwaan)](https://github.com/baukezwaan), [Jascha Ehrenreich (@jaeh)](https://github.com/jaeh), [Chris Wilcoxson (@slushman)](https://github.com/slushman), [Luke Watts (@thisislawatts)](https://github.com/thisislawatts), [Glenn Ansley (@glennansley)](https://github.com/glennansley), [SiteGround](http://www.siteground.com/wordpress-hosting.htm), [Peter Kahoun](http://kahi.cz/), [Jan Lund](), [Michael Jaekel](), [Ιωάννης Δημοφέρλιας (John Dimoferlias)](), [Tomás Nader](), [Claudia Mansilla](http://cricava.com/), [Helen Urbanik](http://www.motomaania.ee/), [Maxime Toulliou](http://www.maximetoulliou.com/), [שגיב בית](http://www.sagive.co.il), [Okostobi](), [Stefan Des](http://www.stefandes.com), [백선기 (SK Baek)](), [Alexander Roterud aka Defrag](http://www.tigerpews.com), [Filip Stas](http://suddenelfilio.net/), [Maria Manoela Porto](), [Tiago Faria](http://xroot.org), [Alexandru Armin Roșu](), [Илья](http://fatcow.com), [Sebastian Johnsson](http://www.agiley.se/), [Hakan E.](http://kazancexpert.com/), [Josh Grosser (@jgrosser-intuit)](https://github.com/jgrosser-intuit), [10up (@10up)](https://github.com/10up), [Nate Conley (@nateconley)](https://github.com/nateconley), [Darin Kotter (@dkotter)](https://github.com/dkotter), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Eddie Shrake (@eddieshrake)](https://github.com/eddieshrake), [Sumit Bagthariya (@qasumitbagthariya)](https://github.com/qasumitbagthariya), [Vikram Moparthy (@vikrampm1)](https://github.com/vikrampm1), [Dharmesh Patel (@iamdharmesh)](https://github.com/iamdharmesh), [GitHub Dependabot (@dependabot)](https://github.com/apps/dependabot). +[Mailchimp (@mailchimp)](https://github.com/mailchimp), [Crowd Favorite (@crowdfavorite)](https://github.com/crowdfavorite), [Matthew Richmond (@bigdawggi)](https://github.com/bigdawggi), [Devin Reams (@devinreams)](https://github.com/devinreams), [Alex King (@alexkingorg)](https://github.com/alexkingorg), [Jesse (@jessedp)](https://github.com/jessedp), [Andrew Ellis](awellis@me.com), [Evan Anderson (@ejdanderson)](https://github.com/ejdanderson), [Webb Henderson (@emerywebster)](https://github.com/emerywebster), [Steven Mathias (@ssmathias)](https://github.com/ssmathias), [Jonathan D. Johnson (@jondavidjohn)](https://github.com/jondavidjohn), [Ross Tweedie (@digitales)](https://github.com/digitales), [(@mcwill)](https://github.com/mcwill), [Andrew Austin (@andrewjaustin)](https://github.com/andrewjaustin), [Marc Queralt i Bassa (@MarcQueralt)](https://github.com/MarcQueralt), [Chris Mospaw (@mospaw)](https://github.com/mospaw), [Jonas Stensved (@jstensved)](https://github.com/jstensved), [netboy](netboy@netboy.pl), [Lenin](lenin@tasawr.com), [Bauke Zwaan (@baukezwaan)](https://github.com/baukezwaan), [Jascha Ehrenreich (@jaeh)](https://github.com/jaeh), [Chris Wilcoxson (@slushman)](https://github.com/slushman), [Luke Watts (@thisislawatts)](https://github.com/thisislawatts), [Glenn Ansley (@glennansley)](https://github.com/glennansley), [SiteGround](http://www.siteground.com/wordpress-hosting.htm), [Peter Kahoun](http://kahi.cz/), [Jan Lund](), [Michael Jaekel](), [Ιωάννης Δημοφέρλιας (John Dimoferlias)](), [Tomás Nader](), [Claudia Mansilla](http://cricava.com/), [Helen Urbanik](http://www.motomaania.ee/), [Maxime Toulliou](http://www.maximetoulliou.com/), [שגיב בית](http://www.sagive.co.il), [Okostobi](), [Stefan Des](http://www.stefandes.com), [백선기 (SK Baek)](), [Alexander Roterud aka Defrag](http://www.tigerpews.com), [Filip Stas](http://suddenelfilio.net/), [Maria Manoela Porto](), [Tiago Faria](http://xroot.org), [Alexandru Armin Roșu](), [Илья](http://fatcow.com), [Sebastian Johnsson](http://www.agiley.se/), [Hakan E.](http://kazancexpert.com/), [Josh Grosser (@jgrosser-intuit)](https://github.com/jgrosser-intuit), [10up (@10up)](https://github.com/10up), [Nate Conley (@nateconley)](https://github.com/nateconley), [Darin Kotter (@dkotter)](https://github.com/dkotter), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Eddie Shrake (@eddieshrake)](https://github.com/eddieshrake), [Sumit Bagthariya (@qasumitbagthariya)](https://github.com/qasumitbagthariya), [Vikram Moparthy (@vikrampm1)](https://github.com/vikrampm1), [Dharmesh Patel (@iamdharmesh)](https://github.com/iamdharmesh), [GitHub Dependabot (@dependabot)](https://github.com/apps/dependabot), [Jer Clarke (@jerclarke)](https://github.com/jerclarke). ## Libraries diff --git a/README.md b/README.md index f67f531..c37d1e0 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ After installation, if you already have a Mailchimp account, you'll log in with If you don't have an account, you can create one directly in the plugin. After entering in all your personal details, you'll need to activate your account via an email that will be sent to you. Once done, you'll proceed to configure settings. -On the settings screen, you'll select your Mailchimp list, choose merge fields and groups, and configure other options. Once done, you can now add the block, widget, or shortcode to your site. Typically, installation and setup will take about 5-10 minutes, and absolutely everything can be done via the WordPress Setting GUI, with no file editing at all. +On the settings screen, you'll select your Mailchimp list, choose merge fields and groups, and configure other options. Once done, you can now add the block, widget, or shortcode (`[mailchimpsf_form]`) to your site. Typically, installation and setup will take about 5-10 minutes, and absolutely everything can be done via the WordPress Setting GUI, with no file editing at all. ![Mailchimp List Subscribe Form block previewing sign up form headers, fields, and button.](https://github.com/mailchimp/wordpress/blob/develop/.wordpress-org/screenshot-3.jpg?raw=true) @@ -73,23 +73,6 @@ If you are upgrading to version 1.2.1 and you used the widget in your sidebar pr If you are upgrading to version 1.6.0, you will need to updated any references to display function `mailchimpSF_signup_form` to `mailchimp_sf_signup_form`. -## Advanced Usage - -If you have a custom-coded sidebar or something that prevent enabling widgets through the WordPress GUI, complete these steps instead. - -WordPress v2.8 or higher: -` [mailchimpsf_form] ` - -If you are adding it inside a php code block, add this: - -` mailchimp_sf_signup_form(); ` - -Or, if you are adding it within HTML, use this: - -`` - -Where ever you want it to show up. - ## Frequently Asked Questions ### Can I have multiple forms on one page? diff --git a/lib/mailchimp/mailchimp.php b/lib/mailchimp/mailchimp.php index 03b35c1..212b97c 100644 --- a/lib/mailchimp/mailchimp.php +++ b/lib/mailchimp/mailchimp.php @@ -190,11 +190,15 @@ public function post( $endpoint, $body, $method = 'POST' ) { // Email address doesn't come back from the API, so if something's wrong, it's that. $field_name = esc_html__( 'Email Address', 'mailchimp' ); $body['errors'][0]['message'] = esc_html__( 'Please fill out a valid email address.', 'mailchimp' ); + } elseif ( ! empty( $body['errors'] ) && isset( $body['errors'][0]['field'] ) && 'email_address' === $body['errors'][0]['field'] ) { + $field_name = esc_html__( 'Email Address', 'mailchimp' ); } elseif ( ! empty( $body['errors'] ) && isset( $body['errors'][0]['field'] ) && $merge['tag'] === $body['errors'][0]['field'] ) { $field_name = $merge['name']; } } - $message = sprintf( $field_name . ': ' . $body['errors'][0]['message'] ); + $message = $body['errors'][0]['message'] ?? esc_html__( 'Something went wrong, Please try again later.', 'mailchimp' ); + $message = ( ! empty( $field_name ) ) ? $field_name . ': ' . $message : $message; + return new WP_Error( 'mc-subscribe-error-api', $message ); } } diff --git a/mailchimp.php b/mailchimp.php index d19e900..f9870e5 100644 --- a/mailchimp.php +++ b/mailchimp.php @@ -4,8 +4,8 @@ * Plugin URI: https://mailchimp.com/help/connect-or-disconnect-list-subscribe-for-wordpress/ * Description: Add a Mailchimp signup form block, widget or shortcode to your WordPress site. * Text Domain: mailchimp - * Version: 1.6.1 - * Requires at least: 6.1 + * Version: 1.6.2 + * Requires at least: 6.3 * Requires PHP: 7.0 * PHP tested up to: 8.3 * Author: Mailchimp @@ -35,7 +35,7 @@ */ // Version constant for easy CSS refreshes -define( 'MCSF_VER', '1.6.1' ); +define( 'MCSF_VER', '1.6.2' ); // What's our permission (capability) threshold define( 'MCSF_CAP_THRESHOLD', 'manage_options' ); diff --git a/package-lock.json b/package-lock.json index 6593c4d..c7ff583 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@mailchimp/wordpress", - "version": "1.6.1", + "version": "1.6.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@mailchimp/wordpress", - "version": "1.6.1", + "version": "1.6.2", "license": "GPL-2.0-or-later", "dependencies": { "@wordpress/block-editor": "^13.2.0", diff --git a/package.json b/package.json index e481711..bc75b71 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mailchimp/wordpress", - "version": "1.6.1", + "version": "1.6.2", "description": "Add a Mailchimp signup form widget to your WordPress site.", "homepage": "https://github.com/mailchimp/wordpress", "bugs": { diff --git a/phpcs-compat.xml b/phpcs-compat.xml index f425f18..5e1f0c0 100644 --- a/phpcs-compat.xml +++ b/phpcs-compat.xml @@ -12,6 +12,6 @@ */node_modules/* */vendor/* - + diff --git a/phpcs.xml b/phpcs.xml index 7463777..477bdbc 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -6,7 +6,7 @@ */tests/* - + diff --git a/readme.txt b/readme.txt index 18e8343..828dab1 100644 --- a/readme.txt +++ b/readme.txt @@ -1,8 +1,8 @@ === Mailchimp List Subscribe Form === Contributors: Mailchimp Tags: mailchimp, email, newsletter, signup, marketing -Tested up to: 6.6 -Stable tag: 1.6.1 +Tested up to: 6.7 +Stable tag: 1.6.2 License: GPL-2.0-or-later License URI: https://spdx.org/licenses/GPL-2.0-or-later.html @@ -16,7 +16,7 @@ After installation, if you already have a Mailchimp account, you'll log in with If you don't have an account, you can create one directly in the plugin. After entering in all your personal details, you'll need to activate your account via an email that will be sent to you. Once done, you'll proceed to configure settings. -On the settings screen, you'll select your Mailchimp list, choose merge fields and groups, and configure other options. Once done, you can now add the block, widget, or shortcode to your site. Typically, installation and setup will take about 5-10 minutes, and absolutely everything can be done via the WordPress Setting GUI, with no file editing at all. +On the settings screen, you'll select your Mailchimp list, choose merge fields and groups, and configure other options. Once done, you can now add the block, widget, or shortcode (`[mailchimpsf_form]`) to your site. Typically, installation and setup will take about 5-10 minutes, and absolutely everything can be done via the WordPress Setting GUI, with no file editing at all. WordPress.com compatibility is limited to Business tier users only. [How to add a signup form if you have a WordPress.com site](https://mailchimp.com/help/ways-to-add-a-signup-form-in-wordpress/). @@ -67,23 +67,6 @@ This section describes how to install the plugin and get started using it. If you are upgrading to version 1.2.1 and you used the widget in your sidebar previously, all you need to do is drag the `Mailchimp Widget` back into the sidebar, visit the Mailchimp settings page (which will have maintained your prior settings), click the "Update List" button, and you're done! -== Advanced == - -If you have a custom-coded sidebar or something that prevents enabling widgets through the WordPress GUI, complete these steps instead. - -WordPress v2.8 or higher: -` [mailchimpsf_form] ` - -If you are adding it inside a php code block, add this: - -` mailchimp_sf_signup_form(); ` - -Or, if you are adding it within HTML, use this: - -`` - -Where ever you want it to show up. - == Screenshots == 1. Mailchimp List Subscribe Form block within the block inserter. @@ -98,6 +81,13 @@ Where ever you want it to show up. == Changelog == += 1.6.2 - 2024-11-12 = +**Note that this release bumps the WordPress minimum version from 6.1 to 6.3.** + +* **Changed:** Bump WordPress "tested up to" version 6.7 (props [@qasumitbagthariya](https://github.com/qasumitbagthariya), [@vikrampm1](https://github.com/vikrampm1), [@dkotter](https://github.com/dkotter) via [#71](https://github.com/mailchimp/wordpress/pull/71)). +* **Changed:** Bump WordPress minimum supported version from 6.1 to 6.3 (props [@qasumitbagthariya](https://github.com/qasumitbagthariya), [@vikrampm1](https://github.com/vikrampm1), [@dkotter](https://github.com/dkotter) via [#71](https://github.com/mailchimp/wordpress/pull/71)). +* **Fixed:** Ensure the field name is properly added to the error message when the email address is blank (props [@iamdharmesh](https://github.com/iamdharmesh), [@jerclarke](https://github.com/jerclarke), [@dkotter](https://github.com/dkotter) via [#74](https://github.com/mailchimp/wordpress/pull/74)). + = 1.6.1 - 2024-10-14 = * **Changed:** Improved migration flow from API Key to OAuth authentication for a better user experience (props [@iamdharmesh](https://github.com/iamdharmesh), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter), [@qasumitbagthariya](https://github.com/qasumitbagthariya) via [#67](https://github.com/mailchimp/wordpress/pull/67)). * **Changed:** Updated the menu SVG icon (props [@dkotter](https://github.com/dkotter), [@jeffpaul](https://github.com/jeffpaul) via [#65](https://github.com/mailchimp/wordpress/pull/65)). @@ -146,6 +136,9 @@ Where ever you want it to show up. == Upgrade Notice == += 1.6.2 = +This release bumps the WordPress minimum version from 6.1 to 6.3. + = 1.6.0 = This version increased the WordPress minimum version to 6.1 and the PHP minimum version to 7.0. diff --git a/tests/cypress/e2e/settings.test.js b/tests/cypress/e2e/settings.test.js index ceb4406..0466b10 100644 --- a/tests/cypress/e2e/settings.test.js +++ b/tests/cypress/e2e/settings.test.js @@ -35,7 +35,7 @@ describe('Admin can update plugin settings', () => { cy.get('#mc_signup_submit').should('exist'); cy.get('#mc_signup_submit').click(); cy.get('.mc_error_msg').should('exist'); - cy.get('.mc_error_msg').contains(': This value should not be blank.'); + cy.get('.mc_error_msg').contains('Email Address: This value should not be blank.'); } }); }); @@ -55,7 +55,7 @@ describe('Admin can update plugin settings', () => { cy.get('#mc_signup_submit').should('exist'); cy.get('#mc_signup_submit').click(); cy.get('.mc_error_msg').should('exist'); - cy.get('.mc_error_msg').contains(': This value should not be blank.'); + cy.get('.mc_error_msg').contains('Email Address: This value should not be blank.'); } }); });