Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ jobs:
env:
CYPRESS_MAILCHIMP_USERNAME: ${{ secrets.MAILCHIMP_USERNAME }}
CYPRESS_MAILCHIMP_PASSWORD: ${{ secrets.MAILCHIMP_PASSWORD }}
CYPRESS_MAILCHIMP_API_KEY: ${{ secrets.MAILCHIMP_API_KEY }}
CYPRESS_MAILCHIMP_API_SERVER_PREFIX: ${{ secrets.MAILCHIMP_API_SERVER_PREFIX }}
strategy:
max-parallel: 1
matrix:
core:
- {name: 'WP latest', version: 'latest'}
Expand Down
85 changes: 85 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/**
* Class Mailchimp_List_Subscribe_Form_Blocks
*
* @since x.x.x
* @since 1.7.0
*/
class Mailchimp_List_Subscribe_Form_Blocks {

Expand Down
10 changes: 5 additions & 5 deletions includes/class-mailchimp-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ public function enqueue_admin_page_scripts( $hook_suffix ) {
/**
* Add the create account page.
*
* @since x.x.x
* @since 1.6.0
*/
public function add_create_account_page() {
add_submenu_page(
Expand All @@ -525,7 +525,7 @@ public function add_create_account_page() {
/**
* Create account page.
*
* @since x.x.x
* @since 1.6.0
*
* @return void
*/
Expand All @@ -544,7 +544,7 @@ public function create_account_page() {
/**
* Get a list of timezones.
*
* @since x.x.x
* @since 1.6.0
*
* @return array
*/
Expand All @@ -555,7 +555,7 @@ private function get_timezones() {
/**
* Get a list of countries.
*
* @since x.x.x
* @since 1.6.0
*
* @return array
*/
Expand Down Expand Up @@ -816,7 +816,7 @@ public function get_countries() {
/**
* Display the Mailchimp footer text on the Mailchimp admin pages.
*
* @since x.x.x
* @since 1.6.0
*
* @param string $text The current footer text.
* @return string The modified footer text.
Expand Down
2 changes: 1 addition & 1 deletion includes/class-mailchimp-block-form-submission.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/**
* Class Mailchimp_Block_Form_Submission
*
* @since x.x.x
* @since 1.7.0
*/
class Mailchimp_Block_Form_Submission {

Expand Down
8 changes: 4 additions & 4 deletions mailchimp.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 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.3
* Version: 1.7.0
* Requires at least: 6.3
* Requires PHP: 7.0
* PHP tested up to: 8.3
Expand Down Expand Up @@ -67,7 +67,7 @@ function () {
use function Mailchimp\WordPress\Includes\Admin\{admin_notice_error, admin_notice_success};

// Version constant for easy CSS refreshes
define( 'MCSF_VER', '1.6.3' );
define( 'MCSF_VER', '1.7.0' );

// What's our permission (capability) threshold
define( 'MCSF_CAP_THRESHOLD', 'manage_options' );
Expand Down Expand Up @@ -987,7 +987,7 @@ function mailchimp_sf_merge_submit( $mv ) {
*/
case 'phone':
if (
'on' === get_option( $opt )
( 'on' === get_option( $opt ) || $mv_var['required'] )
&& isset( $mv_var['options']['phone_format'] )
&& 'US' === $mv_var['options']['phone_format']
) {
Expand All @@ -1006,7 +1006,7 @@ function mailchimp_sf_merge_submit( $mv ) {
* - Merge field is an array (address contains multiple <input> elements)
*/
case 'address':
if ( 'on' === get_option( $opt ) && is_array( $opt_val ) ) {
if ( ( 'on' === get_option( $opt ) || $mv_var['required'] ) && is_array( $opt_val ) ) {
$validate = mailchimp_sf_merge_validate_address( $opt_val, $mv_var );
if ( is_wp_error( $validate ) ) {
return $validate;
Expand Down
2 changes: 1 addition & 1 deletion mailchimp_widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ function mailchimp_sf_signup_form( $args = array() ) {

<div class="mc_form_inside">

<div class="updated mc_message_wrapper" id="mc_message">
<div class="mc_message_wrapper" id="mc_message">
<?php echo wp_kses_post( mailchimp_sf_frontend_msg() ); ?>
</div><!-- /mc_message -->

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mailchimp/wordpress",
"version": "1.6.3",
"version": "1.7.0",
"description": "Add a Mailchimp signup form widget to your WordPress site.",
"homepage": "https://github.com/mailchimp/wordpress",
"bugs": {
Expand Down
16 changes: 15 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Contributors: Mailchimp
Tags: mailchimp, email, newsletter, signup, marketing
Tested up to: 6.7
Stable tag: 1.6.3
Stable tag: 1.7.0
License: GPL-2.0-or-later
License URI: https://spdx.org/licenses/GPL-2.0-or-later.html

Expand Down Expand Up @@ -81,6 +81,20 @@ If you are upgrading to version 1.2.1 and you used the widget in your sidebar pr

== Changelog ==

= 1.7.0 - 2025-04-08 =
* **Changed:** Enhance the Mailchimp List Subscribe Form block to allow for selecting an audience list, reorder fields, toggle field and group visibility, and various other improvements (props [@iamdharmesh](https://github.com/iamdharmesh), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter), [@qasumitbagthariya](https://github.com/qasumitbagthariya) via [#126](https://github.com/mailchimp/wordpress/pull/126)).
* **Changed:** Plugin settings page success and error messages will now use WP admin notices (props [@MaxwellGarceau](https://github.com/MaxwellGarceau), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter), [@qasumitbagthariya](https://github.com/qasumitbagthariya), [@iamdharmesh](https://github.com/iamdharmesh) via [#85](https://github.com/mailchimp/wordpress/pull/85)).
* **Changed:** Renamed `mailchimp_sf_global_msg` function to `mailchimp_sf_frontend_msg` to differentiate functionality from WP admin notices that are used exclusively in the WP Admin (props [@MaxwellGarceau](https://github.com/MaxwellGarceau), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter), [@qasumitbagthariya](https://github.com/qasumitbagthariya), [@iamdharmesh](https://github.com/iamdharmesh) via [#85](https://github.com/mailchimp/wordpress/pull/85)).
* **Changed:** Make the form field visibility dependent on the WordPress "Include?" settings instead of the Mailchimp settings (props [@iamdharmesh](https://github.com/iamdharmesh), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter), [@qasumitbagthariya](https://github.com/qasumitbagthariya), [@MaxwellGarceau](https://github.com/MaxwellGarceau) via [#137](https://github.com/mailchimp/wordpress/pull/137)).
* **Fixed:** Ensure that form data persists when validation fails (props [@iamdharmesh](https://github.com/iamdharmesh), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter), [@qasumitbagthariya](https://github.com/qasumitbagthariya), [@MaxwellGarceau](https://github.com/MaxwellGarceau) via [#130](https://github.com/mailchimp/wordpress/pull/130)).
* **Fixed:** Display an error message informing users that they must subscribe through the hosted form if they were previously unsubscribed (props [@iamdharmesh](https://github.com/iamdharmesh), [@dkotter](https://github.com/dkotter), [@qasumitbagthariya](https://github.com/qasumitbagthariya), [@MaxwellGarceau](https://github.com/MaxwellGarceau) via [#131](https://github.com/mailchimp/wordpress/pull/131), [#140](https://github.com/mailchimp/wordpress/pull/140)).
* **Removed:** The "CSS Cheat Sheet" section from the Mailchimp settings page (props [@iamdharmesh](https://github.com/iamdharmesh), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter), [@qasumitbagthariya](https://github.com/qasumitbagthariya) via [#126](https://github.com/mailchimp/wordpress/pull/126)).
* **Removed:** The "Use JavaScript Support?" option from the Mailchimp settings page (props [@iamdharmesh](https://github.com/iamdharmesh), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter), [@qasumitbagthariya](https://github.com/qasumitbagthariya) via [#126](https://github.com/mailchimp/wordpress/pull/126)).
* **Removed:** The "Use JavaScript Datepicker?" option from the Mailchimp settings page (props [@iamdharmesh](https://github.com/iamdharmesh), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter), [@qasumitbagthariya](https://github.com/qasumitbagthariya) via [#126](https://github.com/mailchimp/wordpress/pull/126)).
* **Removed:** The "Custom Styling" settings from the Mailchimp settings page (props [@iamdharmesh](https://github.com/iamdharmesh), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter), [@qasumitbagthariya](https://github.com/qasumitbagthariya) via [#126](https://github.com/mailchimp/wordpress/pull/126)).
* **Removed:** The "Remove Mailchimp CSS" settings from the Mailchimp settings page (props [@iamdharmesh](https://github.com/iamdharmesh), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter), [@qasumitbagthariya](https://github.com/qasumitbagthariya) via [#126](https://github.com/mailchimp/wordpress/pull/126)).
* **Security:** Bump `express` from 4.21.0 to 4.21.2 (props [@dependabot](https://github.com/apps/dependabot), [@iamdharmesh](https://github.com/iamdharmesh), [@dkotter](https://github.com/dkotter) via [#125](https://github.com/mailchimp/wordpress/pull/125)).

= 1.6.3 - 2025-01-30 =
* **Added:** Transform the `mailchimp_sf_shortcode` shortcode to the Mailchimp List Subscribe Form block (props [@MaxwellGarceau](https://github.com/qasumitbagthariya), [@jeffpaul](https://github.com/vikrampm1), [@dkotter](https://github.com/dkotter), [@qasumitbagthariya](https://github.com/qasumitbagthariya) via [#84](https://github.com/mailchimp/wordpress/pull/84)).
* **Removed:** Deprecated Sopresto code (props [@MaxwellGarceau](https://github.com/qasumitbagthariya), [@jeffpaul](https://github.com/vikrampm1), [@dkotter](https://github.com/dkotter) via [#98](https://github.com/mailchimp/wordpress/pull/98)).
Expand Down
37 changes: 20 additions & 17 deletions tests/cypress/config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const { defineConfig } = require( 'cypress' );
const { loadConfig } = require( '@wordpress/env/lib/config' );
const getCacheDirectory = require( '@wordpress/env/lib/config/get-cache-directory' );
const { defineConfig } = require('cypress');
const { loadConfig } = require('@wordpress/env/lib/config');
const getCacheDirectory = require('@wordpress/env/lib/config/get-cache-directory');
const dotenvPlugin = require('cypress-dotenv');

module.exports = defineConfig( {
module.exports = defineConfig({
chromeWebSecurity: false,
fixturesFolder: 'tests/cypress/fixtures',
screenshotsFolder: 'tests/cypress/screenshots',
Expand All @@ -13,21 +13,24 @@ module.exports = defineConfig( {
reporter: 'mochawesome',
reporterOptions: {
mochaFile: 'mochawesome-[name]',
reportDir: __dirname + '/reports',
reportDir: `${__dirname}/reports`,
overwrite: false,
html: false,
json: true,
},
e2e: {
setupNodeEvents( on, config ) {
setupNodeEvents(on, config) {
config = dotenvPlugin(config, { path: '../../.env.test' }); // Load .env variables into Cypress
return setBaseUrl( on, config );
return setBaseUrl(on, config);
},
specPattern: [
'tests/cypress/e2e/admin.test.js',
'tests/cypress/e2e/settings/admin.test.js',
'tests/cypress/e2e/connect.test.js',
'tests/cypress/e2e/settings.test.js',
'tests/cypress/e2e/mailchimp-block.test.js',
'tests/cypress/e2e/settings/list.test.js',
'tests/cypress/e2e/settings/settings.test.js',
'tests/cypress/e2e/submission/**.test.js',
'tests/cypress/e2e/validation/**.test.js',
'tests/cypress/e2e/block.test.js',
'tests/cypress/e2e/logout.test.js',
],
supportFile: 'tests/cypress/support/index.js',
Expand All @@ -38,23 +41,23 @@ module.exports = defineConfig( {
runMode: 2,
openMode: 0,
},
} );
});

/**
* Set WP URL as baseUrl in Cypress config.
*
* @param {Function} on function that used to register listeners on various events.
* @param {Object} config Cypress Config object.
* @return {Object} Updated Cypress Config object.
* @param {object} config Cypress Config object.
* @returns {object} Updated Cypress Config object.
*/
const setBaseUrl = async ( on, config ) => {
const setBaseUrl = async (on, config) => {
const cacheDirectory = await getCacheDirectory();
const wpEnvConfig = await loadConfig( cacheDirectory );
const wpEnvConfig = await loadConfig(cacheDirectory);

if ( wpEnvConfig ) {
if (wpEnvConfig) {
const port = wpEnvConfig.env.tests.port || null;

if ( port ) {
if (port) {
config.baseUrl = wpEnvConfig.env.tests.config.WP_SITEURL;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ describe('Block Tests', () => {

before(() => {
cy.login();
cy.mailchimpLoginIfNotAlreadyLoggedIn();
cy.toggleMergeFields('check');

// Hide all interest groups
cy.visit('/wp-admin/admin.php?page=mailchimp_sf_options');
cy.get('input[id^="mc_show_interest_groups_"]').uncheck();
cy.get('input[value="Update Subscribe Form Settings"]').first().click();
});

it('Admin can create a Signup form using Mailchimp block', () => {
Expand Down
Loading