Skip to content

Commit b7f7e3b

Browse files
authored
Merge pull request #165 from mailchimp/release/1.9.0
Release/1.9.0
2 parents 7373287 + 8cb244d commit b7f7e3b

14 files changed

+65
-55
lines changed

.wordpress-org/screenshot-6.jpg

-79.8 KB
Loading

.wordpress-org/screenshot-7.jpg

37.9 KB
Loading

.wordpress-org/screenshot-8.jpg

-509 KB
Loading

.wordpress-org/screenshot-9.jpg

-507 KB
Binary file not shown.

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file, per [the Ke
44

55
## [Unreleased] - TBD
66

7+
## [1.9.0] - 2025-06-04
8+
9+
### Added
10+
11+
- New user synchronization feature that allows syncing WordPress users to Mailchimp (props [@iamdharmesh](https://github.com/iamdharmesh), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter), [@qasumitbagthariya](https://github.com/qasumitbagthariya) via [#156](https://github.com/mailchimp/wordpress/pull/156)).
12+
13+
### Changed
14+
15+
- Improved the enqueueing of JavaScript scripts and styles (props [@iamdharmesh](https://github.com/iamdharmesh), [@dkotter](https://github.com/dkotter), [@qasumitbagthariya](https://github.com/qasumitbagthariya) via [#161](https://github.com/mailchimp/wordpress/pull/161)).
16+
717
## [1.8.0] - 2025-05-08
818

919
**Note that this release bumps the WordPress minimum version from 6.3 to 6.4.**
@@ -313,6 +323,7 @@ All notable changes to this project will be documented in this file, per [the Ke
313323
- Security and various other improvements
314324

315325
[Unreleased]: https://github.com/mailchimp/wordpress/compare/main...develop
326+
[1.9.0]: https://github.com/mailchimp/wordpress/compare/1.8.0...1.9.0
316327
[1.8.0]: https://github.com/mailchimp/wordpress/compare/1.7.0...1.8.0
317328
[1.7.0]: https://github.com/mailchimp/wordpress/compare/1.6.3...1.7.0
318329
[1.6.3]: https://github.com/mailchimp/wordpress/compare/1.6.2...1.6.3

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Starting in version 1.6.0, authentication has changed to use OAuth. As part of t
2828

2929
With no additional configuration, we use the standard `LOGGED_IN_KEY` and `LOGGED_IN_SALT` constants that are normally set in your site's `wp-config.php` file. Some sites make use of security plugins that rotate these constants on a periodic basis. When this happens, we won't be able to decrypt the access token and you’ll need to reconnect your Mailchimp account to generate a new access token.
3030

31-
To prevent such issues, it is recommended to define two additional constants in your site's `wp-config.php` file: `MAILCHIMP_SF_ENCRYPTION_KEY` and `MAILCHIMP_SF_ENCRYPTION_SALT`. These constants should consist of a combination of characters, preferably at least 32 characters long. Once set, these values should not be changed. For strong values, you can copy some of the values from [here](https://api.wordpress.org/secret-key/1.1/salt/) and use them. You'll end up with additional code like the following in your `wp-config.php` file:
31+
To prevent such issues, it is recommended to define two additional constants in your site's `wp-config.php` file: `MAILCHIMP_SF_ENCRYPTION_KEY` and `MAILCHIMP_SF_ENCRYPTION_SALT`. These constants should consist of a combination of characters, preferably at least 32 characters long. Once set, these values should not be changed. For strong values, you can copy some of the values from the [WordPress Secret Key Generator](https://api.wordpress.org/secret-key/1.1/salt/) and use them. You'll end up with additional code like the following in your `wp-config.php` file:
3232

3333
```php
3434
define( 'MAILCHIMP_SF_ENCRYPTION_KEY', 'put your unique phrase here' );
@@ -49,23 +49,21 @@ This section describes how to install the plugin and get started using it.
4949

5050
![Connecting your Mailchimp account to WordPress via OAuth.](https://github.com/mailchimp/wordpress/blob/develop/.wordpress-org/screenshot-4.jpg?raw=true)
5151

52-
![Creating a new Mailchimp account.](https://github.com/mailchimp/wordpress/blob/develop/.wordpress-org/screenshot-9.jpg?raw=true)
52+
![Creating a new Mailchimp account.](https://github.com/mailchimp/wordpress/blob/develop/.wordpress-org/screenshot-7.jpg?raw=true)
5353

5454
4. Click the Log in button and proceed through the OAuth flow, logging in to your Mailchimp account and authorizing the application. If you don't have an acccount, instead click the "Create an account" button to create one.
5555

5656
![Logged in to your Mailchimp account and selecting a list to connect to.](https://github.com/mailchimp/wordpress/blob/develop/.wordpress-org/screenshot-5.jpg?raw=true)
5757

5858
5. Select the list where you want to send new Mailchimp subscribers.
5959

60-
![Configuring your Signup Form display format (optional).](https://github.com/mailchimp/wordpress/blob/develop/.wordpress-org/screenshot-6.jpg?raw=true)
61-
6260
6. Optional: Turn **Merge Fields** and **Groups** on or off. Navigate to **Appearance**, and click **Widgets**. Drag the Mailchimp Widget into one of your Widget Areas.
6361

64-
![Configuring extra fields on your Signup Form (optional).](https://github.com/mailchimp/wordpress/blob/develop/.wordpress-org/screenshot-7.jpg?raw=true)
62+
![Configuring extra fields on your Signup Form (optional).](https://github.com/mailchimp/wordpress/blob/develop/.wordpress-org/screenshot-6.jpg?raw=true)
6563

66-
7. Optional: adjust frontend site display with available CSS options.
64+
7. Optional: turn on user synchronization to sync WordPress users to Mailchimp.
6765

68-
![CSS options for styling your Signup Form.](https://github.com/mailchimp/wordpress/blob/develop/.wordpress-org/screenshot-8.jpg?raw=true)
66+
![Configuring user synchronization settings.](https://github.com/mailchimp/wordpress/blob/develop/.wordpress-org/screenshot-8.jpg?raw=true)
6967

7068
## Upgrading
7169

@@ -88,23 +86,25 @@ You need to ensure that the fields are enabled both in your Mailchimp account (A
8886
Internationalization (i18n) is available on GlotPress at [https://translate.wordpress.org/projects/wp-plugins/mailchimp/](https://translate.wordpress.org/projects/wp-plugins/mailchimp/). Any assistance [translating the plugin](https://translate.wordpress.org/projects/wp-plugins/mailchimp/) is greatly appreciated!
8987

9088
## E2E tests
89+
9190
The `tests` directory contains end-to-end tests for the project, utilizing Cypress to run tests in an environment created using wp-env.
9291

9392
### Pre-requisites
93+
9494
- Node.js v20
9595
- Docker
9696
- Create an account in [Mailchimp](https://mailchimp.com/)
9797

9898
### Run E2E tests in local
99+
99100
1. Run `npm install`.
100101
2. Run `npm run build`.
101102
3. Run `npm run env:start`.
102103
4. Duplicate the `.env.test.sample` file and rename `.env.test`. Populate this file with your own Mailchimp account credentials.
103104
- **NOTE:** Use a test account that does not require 2FA. 2FA will fail some of the tests.
104105
5. Set your Mailchimp account up
105-
- Name the audience in your Mailchimp test account "10up". Required for `settings.test.js`.
106-
- Enable all merge fields. From your Mailchimp account home page -> `/audience/settings/` -> Edit merge fields/tags -> Set all merge fields to "visible". Required for `settings.test.js`.
107-
106+
- Name the audience in your Mailchimp test account "10up". Required for `settings.test.js`.
107+
- Enable all merge fields. From your Mailchimp account home page -> `/audience/settings/` -> Edit merge fields/tags -> Set all merge fields to "visible". Required for `settings.test.js`.
108108
6. Run `npm run cypress:run`. You can also run `npm run cypress:open` to run tests in UI mode.
109109

110110
## Support Level

assets/css/admin.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ table.mc-widefat, .mailchimp-sf-user-sync-page table.form-table {
4747
}
4848

4949
.mailchimp-sf-user-sync-page table.form-table {
50-
display: block;
50+
border-collapse: separate;
51+
border-spacing: 0px;
5152
}
5253

5354
.mailchimp-sf-user-sync-page table.form-table tr:first-child,

includes/admin/class-mailchimp-user-sync.php

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,30 @@
1313
/**
1414
* Class Mailchimp_User_Sync
1515
*
16-
* @since x.x.x
16+
* @since 1.9.0
1717
*/
1818
class Mailchimp_User_Sync {
1919

2020
/**
2121
* The option name.
2222
*
23-
* @since x.x.x
23+
* @since 1.9.0
2424
* @var string
2525
*/
2626
protected $option_name = 'mailchimp_sf_user_sync_settings';
2727

2828
/**
2929
* The errors option name.
3030
*
31-
* @since x.x.x
31+
* @since 1.9.0
3232
* @var string
3333
*/
3434
protected $errors_option_name = 'mailchimp_sf_user_sync_errors';
3535

3636
/**
3737
* The background process.
3838
*
39-
* @since x.x.x
39+
* @since 1.9.0
4040
* @var Mailchimp_User_Sync_Background_Process
4141
*/
4242
protected $background_process;
@@ -83,7 +83,7 @@ public function init() {
8383
/**
8484
* Register the user sync settings.
8585
*
86-
* @since x.x.x
86+
* @since 1.9.0
8787
*/
8888
public function register_settings() {
8989
$args = array(
@@ -96,7 +96,7 @@ public function register_settings() {
9696
/**
9797
* Setup the fields and sections.
9898
*
99-
* @since x.x.x
99+
* @since 1.9.0
100100
*/
101101
public function setup_fields_sections() {
102102
$section_id = $this->option_name . '_section';
@@ -171,7 +171,7 @@ public function setup_fields_sections() {
171171
/**
172172
* Get the user sync settings.
173173
*
174-
* @since x.x.x
174+
* @since 1.9.0
175175
* @param string|null $key The key to get.
176176
* @return array|null The user sync settings.
177177
*/
@@ -198,15 +198,15 @@ public function get_user_sync_settings( $key = null ) {
198198
/**
199199
* Sanitize the user sync settings.
200200
*
201-
* @since x.x.x
201+
* @since 1.9.0
202202
* @param array $new_settings The settings to sanitize.
203203
* @return array The sanitized settings.
204204
*/
205205
public function sanitize_user_sync_settings( $new_settings ) {
206206
$settings = $this->get_user_sync_settings();
207-
$settings['enable_user_sync'] = isset( $new_settings['enable_user_sync'] ) ? 1 : 0;
207+
$settings['enable_user_sync'] = ( isset( $new_settings['enable_user_sync'] ) && 1 === absint( $new_settings['enable_user_sync'] ) ) ? 1 : 0;
208208
$settings['user_roles'] = isset( $new_settings['user_roles'] ) ? array_map( 'sanitize_text_field', $new_settings['user_roles'] ) : array();
209-
$settings['existing_contacts_only'] = isset( $new_settings['existing_contacts_only'] ) ? 1 : 0;
209+
$settings['existing_contacts_only'] = ( isset( $new_settings['existing_contacts_only'] ) && 1 === absint( $new_settings['existing_contacts_only'] ) ) ? 1 : 0;
210210
$settings['subscriber_status'] = isset( $new_settings['subscriber_status'] ) ? sanitize_text_field( $new_settings['subscriber_status'] ) : 'pending';
211211

212212
return $settings;
@@ -215,7 +215,7 @@ public function sanitize_user_sync_settings( $new_settings ) {
215215
/**
216216
* Render the user roles field.
217217
*
218-
* @since x.x.x
218+
* @since 1.9.0
219219
*/
220220
public function user_roles_field() {
221221
$settings = $this->get_user_sync_settings( 'user_roles' );
@@ -248,7 +248,7 @@ public function user_roles_field() {
248248
/**
249249
* Render the enable user sync field.
250250
*
251-
* @since x.x.x
251+
* @since 1.9.0
252252
*/
253253
public function enable_user_sync_field() {
254254
$value = $this->get_user_sync_settings( 'enable_user_sync' );
@@ -269,7 +269,7 @@ public function enable_user_sync_field() {
269269
/**
270270
* Render the subscriber status field.
271271
*
272-
* @since x.x.x
272+
* @since 1.9.0
273273
*/
274274
public function subscriber_status_field() {
275275
$settings = $this->get_user_sync_settings( 'subscriber_status' );
@@ -335,7 +335,7 @@ public function subscriber_status_field() {
335335
/**
336336
* Render the existing contacts only field.
337337
*
338-
* @since x.x.x
338+
* @since 1.9.0
339339
*/
340340
public function existing_contacts_only_field() {
341341
$settings = $this->get_user_sync_settings();
@@ -351,7 +351,7 @@ public function existing_contacts_only_field() {
351351
/**
352352
* Render the sync all users field.
353353
*
354-
* @since x.x.x
354+
* @since 1.9.0
355355
*/
356356
public function sync_all_users_button() {
357357
$start_sync_url = wp_nonce_url( add_query_arg( 'action', 'mailchimp_sf_start_user_sync', admin_url( 'admin-post.php' ) ), 'mailchimp_sf_start_user_sync', 'mailchimp_sf_start_user_sync_nonce' );
@@ -368,7 +368,7 @@ public function sync_all_users_button() {
368368
/**
369369
* Start the user sync.
370370
*
371-
* @since x.x.x
371+
* @since 1.9.0
372372
*/
373373
public function start_user_sync() {
374374
if (
@@ -445,7 +445,7 @@ public function start_user_sync() {
445445
/**
446446
* Cancel the user sync.
447447
*
448-
* @since x.x.x
448+
* @since 1.9.0
449449
*/
450450
public function cancel_user_sync() {
451451
if (
@@ -479,7 +479,7 @@ public function cancel_user_sync() {
479479
/**
480480
* Skip the user sync cta.
481481
*
482-
* @since x.x.x
482+
* @since 1.9.0
483483
*/
484484
public function skip_user_sync_cta() {
485485
if (
@@ -579,7 +579,7 @@ public function render_notices() {
579579
/**
580580
* Get the total users.
581581
*
582-
* @since x.x.x
582+
* @since 1.9.0
583583
* @return int The total users.
584584
*/
585585
public function get_users_count() {
@@ -601,7 +601,7 @@ public function get_users_count() {
601601
/**
602602
* Get the user sync status.
603603
*
604-
* @since x.x.x
604+
* @since 1.9.0
605605
*/
606606
public function render_user_sync_status() {
607607
$is_syncing = $this->background_process->in_progress();
@@ -622,7 +622,7 @@ public function render_user_sync_status() {
622622
/**
623623
* Render the user sync start cta.
624624
*
625-
* @since x.x.x
625+
* @since 1.9.0
626626
*/
627627
public function render_user_sync_start_cta() {
628628
// Check if the cta is already shown.
@@ -680,7 +680,7 @@ public function render_user_sync_start_cta() {
680680
/**
681681
* Get the user sync progress.
682682
*
683-
* @since x.x.x
683+
* @since 1.9.0
684684
*/
685685
public function render_user_sync_progress() {
686686
$is_syncing = $this->background_process->in_progress();
@@ -755,7 +755,7 @@ public function get_user_sync_status() {
755755
/**
756756
* Get the user sync errors.
757757
*
758-
* @since x.x.x
758+
* @since 1.9.0
759759
* @return array The user sync errors.
760760
*/
761761
public function get_user_sync_errors() {
@@ -765,7 +765,7 @@ public function get_user_sync_errors() {
765765
/**
766766
* Set the user sync errors.
767767
*
768-
* @since x.x.x
768+
* @since 1.9.0
769769
* @param array $errors The user sync errors.
770770
*/
771771
public function set_user_sync_errors( $errors ) {
@@ -781,7 +781,7 @@ public function set_user_sync_errors( $errors ) {
781781
/**
782782
* Delete the user sync error.
783783
*
784-
* @since x.x.x
784+
* @since 1.9.0
785785
*
786786
* @param string $id The id of the user sync error.
787787
*/
@@ -804,7 +804,7 @@ public function delete_user_sync_errors( $id ) {
804804
* Render the user sync errors.
805805
* Note: This is only renders last 100 records.
806806
*
807-
* @since x.x.x
807+
* @since 1.9.0
808808
*/
809809
public function render_user_sync_errors() {
810810
$errors = $this->get_user_sync_errors();

includes/class-mailchimp-admin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ public function create_account_page() {
560560
/**
561561
* Render the settings page.
562562
*
563-
* @since x.x.x
563+
* @since 1.9.0
564564
*
565565
* @return void
566566
*/

includes/class-mailchimp-user-sync-backgroud-process.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
/**
1414
* Class Mailchimp_User_Sync_Background_Process
1515
*
16-
* @since x.x.x
16+
* @since 1.9.0
1717
*/
1818
class Mailchimp_User_Sync_Background_Process {
1919

0 commit comments

Comments
 (0)