Skip to content

Commit 5ad9b5d

Browse files
remove list fetcher component entirely - prefer server-side flow
1 parent 330601e commit 5ad9b5d

File tree

4 files changed

+2
-92
lines changed

4 files changed

+2
-92
lines changed

assets/src/js/admin.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
const tabs = require('./admin/tabs.js')
33
const settings = require('./admin/settings.js')
44

5-
require('./admin/list-fetcher.js')
65
require('./admin/fields/mailchimp-api-key.js')
76
require('./admin/list-overview.js')
87
require('./admin/show-if.js')

assets/src/js/admin/list-fetcher.js

Lines changed: 0 additions & 73 deletions
This file was deleted.

includes/admin/class-admin-ajax.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,9 @@ public function __construct(MC4WP_Admin_Tools $tools)
2222
*/
2323
public function add_hooks()
2424
{
25-
add_action('wp_ajax_mc4wp_renew_mailchimp_lists', [ $this, 'refresh_mailchimp_lists' ]);
2625
add_action('wp_ajax_mc4wp_get_list_details', [ $this, 'get_list_details' ]);
2726
}
2827

29-
/**
30-
* Empty lists cache & fetch lists again.
31-
*/
32-
public function refresh_mailchimp_lists()
33-
{
34-
if (! $this->tools->is_user_authorized()) {
35-
wp_send_json_error();
36-
return;
37-
}
38-
39-
check_ajax_referer('mc4wp-ajax');
40-
41-
$mailchimp = new MC4WP_MailChimp();
42-
$success = $mailchimp->refresh_lists();
43-
wp_send_json($success);
44-
}
4528

4629
/**
4730
* Retrieve details (merge fields and interest categories) for one or multiple lists in Mailchimp

includes/views/parts/lists-overview.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
<p><?php echo esc_html__('The table below shows your Mailchimp audiences and their details. If you just applied changes to your Mailchimp account, please use the following button to renew the cache.', 'mailchimp-for-wp'); ?></p>
33

44
<div id="mc4wp-list-fetcher">
5-
<form method="post">
5+
<form method="post" action="">
66
<input type="hidden" name="_mc4wp_action" value="empty_lists_cache" />
7+
<?php echo wp_nonce_field('_mc4wp_action'); ?>
78
<p>
89
<input type="submit" value="<?php echo esc_attr__('Renew Mailchimp audiences', 'mailchimp-for-wp'); ?>" class="button">
910
</p>

0 commit comments

Comments
 (0)