From 2f038f0955c37686f27b35f1fde631424470ce60 Mon Sep 17 00:00:00 2001 From: Sumit Bagthariya <67687255+qasumitbagthariya@users.noreply.github.com> Date: Fri, 27 Mar 2026 13:07:14 +0530 Subject: [PATCH 1/6] Bump WordPress Tested up to version 7.0 --- .github/workflows/e2e.yml | 2 +- mailchimp.php | 2 +- phpcs.xml | 2 +- readme.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 84062bd2..d6fd552f 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -27,7 +27,7 @@ jobs: matrix: core: - {name: 'WP latest', version: 'latest'} - - {name: 'WP minimum', version: 'WordPress/WordPress#6.4'} + - {name: 'WP minimum', version: 'WordPress/WordPress#6.6'} - {name: 'WP trunk', version: 'WordPress/WordPress#master'} steps: diff --git a/mailchimp.php b/mailchimp.php index caf1cd26..e06549c9 100644 --- a/mailchimp.php +++ b/mailchimp.php @@ -5,7 +5,7 @@ * Description: Add a Mailchimp signup form block, widget or shortcode to your WordPress site. * Text Domain: mailchimp * Version: 2.0.1 - * Requires at least: 6.4 + * Requires at least: 6.6 * Requires PHP: 7.0 * PHP tested up to: 8.3 * Author: Mailchimp diff --git a/phpcs.xml b/phpcs.xml index 555ec4b2..ea8ca060 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -6,7 +6,7 @@ */tests/* - + diff --git a/readme.txt b/readme.txt index 91703902..0838902f 100644 --- a/readme.txt +++ b/readme.txt @@ -1,7 +1,7 @@ === Mailchimp List Subscribe Form === Contributors: Mailchimp Tags: mailchimp, email, newsletter, signup, marketing -Tested up to: 6.9 +Tested up to: 7.0 Stable tag: 2.0.1 License: GPL-2.0-or-later License URI: https://spdx.org/licenses/GPL-2.0-or-later.html From 0561bf3102256cfc1119f4bffff8dd77956bcee8 Mon Sep 17 00:00:00 2001 From: Dharmesh Patel Date: Thu, 21 May 2026 18:21:43 +0530 Subject: [PATCH 2/6] Add Mailchimp_Admin_Notices class for improved admin notice handling. --- includes/admin/admin-notices.php | 65 ++------- .../admin/class-mailchimp-admin-notices.php | 129 ++++++++++++++++++ includes/class-mailchimp-admin.php | 2 + mailchimp.php | 1 + 4 files changed, 142 insertions(+), 55 deletions(-) create mode 100644 includes/admin/class-mailchimp-admin-notices.php diff --git a/includes/admin/admin-notices.php b/includes/admin/admin-notices.php index 16dd25b3..695fc912 100644 --- a/includes/admin/admin-notices.php +++ b/includes/admin/admin-notices.php @@ -9,73 +9,28 @@ /** * Display success admin notice. - * - * NOTE: WordPress localization i18n functionality should be done - * on string literals outside of this function in order to work - * correctly. - * - * For more info read here: https://salferrarello.com/why-__-needs-a-hardcoded-string-in-wordpress/ + * This function is now a wrapper around the Mailchimp_Admin_Notices class, will be deprecated in future versions. Use that class instead. * * @since 1.7.0 + * @since x.x.x - Moved notice rendering to class-mailchimp-admin-notices.php + * * @param string $msg The message to display. * @return void */ -function admin_notice_success( string $msg ) { - ?> -
-

- array( - 'href' => array(), - 'title' => array(), - 'target' => array(), - ), - 'strong' => array(), - 'em' => array(), - 'br' => array(), - ) - ); - ?> -

-
- add( $msg, 'success' ); } /** * Display error admin notice. - * - * NOTE: WordPress localization i18n functionality should be done - * on string literals outside of this function in order to work - * correctly. - * - * For more info read here: https://salferrarello.com/why-__-needs-a-hardcoded-string-in-wordpress/ + * This function is now a wrapper around the Mailchimp_Admin_Notices class, will be deprecated in future versions. Use that class instead. * * @since 1.7.0 + * @since x.x.x - Moved notice rendering to class-mailchimp-admin-notices.php + * * @param string $msg The message to display. * @return void */ -function admin_notice_error( string $msg ) { - ?> -
-

- array( - 'href' => array(), - 'title' => array(), - 'target' => array(), - ), - 'strong' => array(), - 'em' => array(), - ) - ); - ?> -

-
- add( $msg, 'error' ); } diff --git a/includes/admin/class-mailchimp-admin-notices.php b/includes/admin/class-mailchimp-admin-notices.php new file mode 100644 index 00000000..f181c43b --- /dev/null +++ b/includes/admin/class-mailchimp-admin-notices.php @@ -0,0 +1,129 @@ + + */ + private $notices = array(); + + /** + * Get the singleton instance. + * + * @return Mailchimp_Admin_Notices + */ + public static function instance(): Mailchimp_Admin_Notices { + if ( null === self::$instance ) { + self::$instance = new self(); + } + + return self::$instance; + } + + /** + * Register the admin_notices hook. + * + * @return void + */ + public function init(): void { + add_action( 'admin_notices', array( $this, 'render' ) ); + } + + /** + * Queue an admin notice. + * + * @param string $message Notice message (already escaped/translated by caller). + * @param string $type Notice type: success or error. + * @return void + */ + public function add( string $message, string $type ): void { + if ( ! is_admin() ) { + return; + } + + if ( did_action( 'admin_notices' ) ) { + $this->print_notice( $message, $type ); + return; + } + + $this->notices[] = array( + 'message' => $message, + 'type' => $type, + ); + } + + /** + * Render all queued notices. + * + * @return void + */ + public function render(): void { + foreach ( $this->notices as $notice ) { + $this->print_notice( $notice['message'], $notice['type'] ); + } + + $this->notices = array(); + } + + /** + * Print a single admin notice. + * + * @param string $message Notice message. + * @param string $type Notice type: success or error. + * @return void + */ + private function print_notice( string $message, string $type ): void { + $classes = array( 'notice', 'notice-' . sanitize_html_class( $type ) ); + + if ( 'success' === $type ) { + $classes[] = 'is-dismissible'; + } + + $allowed_html = array( + 'a' => array( + 'href' => array(), + 'title' => array(), + 'target' => array(), + ), + 'strong' => array(), + 'em' => array(), + 'br' => array(), + ); + + ?> +
+

+ +

+
+ init(); + $user_sync = new Mailchimp_User_Sync(); $user_sync->init(); } diff --git a/mailchimp.php b/mailchimp.php index e06549c9..7e539a12 100644 --- a/mailchimp.php +++ b/mailchimp.php @@ -96,6 +96,7 @@ function () { // Init Admin functions. require_once plugin_dir_path( __FILE__ ) . 'includes/class-mailchimp-user-sync-backgroud-process.php'; require_once plugin_dir_path( __FILE__ ) . 'includes/admin/class-mailchimp-user-sync.php'; +require_once plugin_dir_path( __FILE__ ) . 'includes/admin/class-mailchimp-admin-notices.php'; require_once plugin_dir_path( __FILE__ ) . 'includes/class-mailchimp-admin.php'; $admin = new Mailchimp_Admin(); $admin->init(); From 79ed2ac9ffe5e24e677aff8682e72e5e63e1826a Mon Sep 17 00:00:00 2001 From: Dharmesh Patel Date: Thu, 21 May 2026 18:34:29 +0530 Subject: [PATCH 3/6] Enhance radio button styling in admin CSS by adding a background color for checked state. for WP 7.0 --- assets/css/admin.css | 1 + 1 file changed, 1 insertion(+) diff --git a/assets/css/admin.css b/assets/css/admin.css index 9014abd5..2ca927a4 100644 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -1449,6 +1449,7 @@ input[type=radio].mailchimp-sf-radio { input[type=radio].mailchimp-sf-radio:checked { border: 2px solid var(--mailchimp-color-link); + background-color: #fff; } input[type=radio].mailchimp-sf-radio:checked:before { From 5be44605645f99ca69bb132f0b158873f9219420 Mon Sep 17 00:00:00 2001 From: Dharmesh Patel Date: Thu, 21 May 2026 18:37:24 +0530 Subject: [PATCH 4/6] Refactor admin notice functions to remove return type declarations for compatibility. --- includes/admin/admin-notices.php | 4 ++-- includes/admin/class-mailchimp-admin-notices.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/includes/admin/admin-notices.php b/includes/admin/admin-notices.php index 695fc912..6c8ff261 100644 --- a/includes/admin/admin-notices.php +++ b/includes/admin/admin-notices.php @@ -17,7 +17,7 @@ * @param string $msg The message to display. * @return void */ -function admin_notice_success( string $msg ): void { +function admin_notice_success( string $msg ) { \Mailchimp_Admin_Notices::instance()->add( $msg, 'success' ); } @@ -31,6 +31,6 @@ function admin_notice_success( string $msg ): void { * @param string $msg The message to display. * @return void */ -function admin_notice_error( string $msg ): void { +function admin_notice_error( string $msg ) { \Mailchimp_Admin_Notices::instance()->add( $msg, 'error' ); } diff --git a/includes/admin/class-mailchimp-admin-notices.php b/includes/admin/class-mailchimp-admin-notices.php index f181c43b..5d8d4df2 100644 --- a/includes/admin/class-mailchimp-admin-notices.php +++ b/includes/admin/class-mailchimp-admin-notices.php @@ -53,7 +53,7 @@ public static function instance(): Mailchimp_Admin_Notices { * * @return void */ - public function init(): void { + public function init() { add_action( 'admin_notices', array( $this, 'render' ) ); } @@ -64,7 +64,7 @@ public function init(): void { * @param string $type Notice type: success or error. * @return void */ - public function add( string $message, string $type ): void { + public function add( string $message, string $type ) { if ( ! is_admin() ) { return; } @@ -85,7 +85,7 @@ public function add( string $message, string $type ): void { * * @return void */ - public function render(): void { + public function render() { foreach ( $this->notices as $notice ) { $this->print_notice( $notice['message'], $notice['type'] ); } @@ -100,7 +100,7 @@ public function render(): void { * @param string $type Notice type: success or error. * @return void */ - private function print_notice( string $message, string $type ): void { + private function print_notice( string $message, string $type ) { $classes = array( 'notice', 'notice-' . sanitize_html_class( $type ) ); if ( 'success' === $type ) { From aa1897249af6a408d1e5f280aff2199358b6c969 Mon Sep 17 00:00:00 2001 From: Dharmesh Patel Date: Fri, 22 May 2026 01:21:10 +0530 Subject: [PATCH 5/6] E2E: Ignore "uncaught:exception" to prevent test from failing. --- tests/cypress/support/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/cypress/support/index.js b/tests/cypress/support/index.js index 76d9fdaf..3edb7ce6 100644 --- a/tests/cypress/support/index.js +++ b/tests/cypress/support/index.js @@ -16,6 +16,18 @@ import '@10up/cypress-wp-utils'; import './commands'; +Cypress.on('uncaught:exception', (err, runnable) => { + /* + * Noticed this "Transition was skipped" error on WP 7.0 + */ + if (err.message.includes('Transition was skipped')) { + // returning false here prevents Cypress from failing the test + return false; + } + + return runnable; +}); + // TODO: Initialize tests from a blank state // TODO: Wipe WP data related to a users options // TODO: Delete all contacts in a users Mailchimp account From bd3a89a26e0aa04c0a71706f6883d946a991b956 Mon Sep 17 00:00:00 2001 From: Dharmesh Patel Date: Fri, 22 May 2026 01:23:29 +0530 Subject: [PATCH 6/6] Update minimum supported WordPress version to 6.6 in phpcs-compat.xml --- phpcs-compat.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpcs-compat.xml b/phpcs-compat.xml index 3dbb2557..60a16e5c 100644 --- a/phpcs-compat.xml +++ b/phpcs-compat.xml @@ -12,6 +12,6 @@ */node_modules/* */vendor/* - +