WooCommerce MailChimp - Version 2.1.14

Version Description

Download this release

Release Info

Developer anderly
Plugin Icon 128x128 WooCommerce MailChimp
Version 2.1.14
Comparing to
See all releases

Code changes from version 2.1.13 to 2.1.14

includes/class-ss-wc-mailchimp-handler.php CHANGED
@@ -123,7 +123,7 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
123
  $this->log( sprintf( __( __METHOD__ . '(): Queueing maybe subscribe ($subscribe_customer: %s) for customer (%s) to list %s', 'woocommerce-mailchimp'), $subscribe_customer, $order_billing_email, $list_id ) );
124
 
125
  // Queue the subscription.
126
- as_schedule_single_action( time(), 'queue_ss_wc_mailchimp_maybe_subscribe', array( $subscribe_customer, $order_id, $order_billing_first_name, $order_billing_last_name, $order_billing_email , $list_id ), 'sswcmc' );
127
 
128
  }
129
  }
@@ -138,11 +138,11 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
138
 
139
  try {
140
 
141
- if ( !isset($_POST['data']) ) {
142
  throw new Exception( __( __METHOD__ . ': $_POST[\'data\'] not provided.', 'woocommerce-mailchimp' ) );
143
  }
144
 
145
- if ( !$_POST['data']['api_key'] || empty( $_POST['data']['api_key'] ) ) {
146
 
147
  throw new Exception( __( 'Please enter an api key.', 'woocommerce-mailchimp' ) );
148
 
@@ -154,8 +154,7 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
154
 
155
  $results = $account;
156
 
157
- }
158
- catch ( Exception $e ) {
159
 
160
  return $this->toJSON( array( 'error' => $e->getMessage() ) );
161
 
@@ -175,7 +174,7 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
175
 
176
  try {
177
 
178
- if ( !$_POST['data']['api_key'] || empty( $_POST['data']['api_key'] ) ) {
179
 
180
  return $this->toJSON( array( '' => __( 'Enter your api key above to see your lists', 'woocommerce-mailchimp' ) ) );
181
 
@@ -185,10 +184,9 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
185
 
186
  $lists = $this->sswcmc->mailchimp( $api_key )->get_lists();
187
 
188
- $results = array_merge( array('' => 'Select a list...'), $lists );
189
 
190
- }
191
- catch ( Exception $e ) {
192
 
193
  return $this->toJSON( array( 'error' => $e->getMessage() ) );
194
 
@@ -208,13 +206,13 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
208
 
209
  try {
210
 
211
- if ( !$_POST['data']['api_key'] || empty( $_POST['data']['api_key'] ) ) {
212
 
213
  return $this->toJSON( array( '' => __( 'Enter your api key above to see your lists', 'ss_wc_mailchimp' ) ) );
214
 
215
  }
216
 
217
- if ( !$_POST['data']['list_id'] || empty( $_POST['data']['list_id'] ) ) {
218
 
219
  return $this->toJSON( array( '' => __( 'Please select a list from above.', 'ss_wc_mailchimp' ) ) );
220
 
@@ -227,8 +225,7 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
227
 
228
  $results = $interest_groups;
229
 
230
- }
231
- catch ( Exception $e ) {
232
 
233
  return $this->toJSON( array( 'error' => $e->getMessage() ) );
234
 
@@ -352,7 +349,7 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
352
 
353
  $interest_groups = $this->sswcmc->interest_groups();
354
 
355
- if ( ! empty( $interest_groups ) ) {
356
  $interest_groups = array_fill_keys( $this->sswcmc->interest_groups(), true );
357
 
358
  // Allow hooking into variables.
@@ -373,7 +370,7 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
373
  );
374
 
375
  // Allow hooking into subscription options.
376
- $options = apply_filters( 'ss_wc_mailchimp_subscribe_options', $subscribe_options, $order_id );
377
 
378
  // Extract options into variables.
379
  extract( $options );
123
  $this->log( sprintf( __( __METHOD__ . '(): Queueing maybe subscribe ($subscribe_customer: %s) for customer (%s) to list %s', 'woocommerce-mailchimp'), $subscribe_customer, $order_billing_email, $list_id ) );
124
 
125
  // Queue the subscription.
126
+ as_schedule_single_action( time(), 'queue_ss_wc_mailchimp_maybe_subscribe', array( $subscribe_customer, $order_id, $order_billing_first_name, $order_billing_last_name, $order_billing_email, $list_id ), 'sswcmc' );
127
 
128
  }
129
  }
138
 
139
  try {
140
 
141
+ if ( ! isset( $_POST['data'] ) ) {
142
  throw new Exception( __( __METHOD__ . ': $_POST[\'data\'] not provided.', 'woocommerce-mailchimp' ) );
143
  }
144
 
145
+ if ( ! $_POST['data']['api_key'] || empty( $_POST['data']['api_key'] ) ) {
146
 
147
  throw new Exception( __( 'Please enter an api key.', 'woocommerce-mailchimp' ) );
148
 
154
 
155
  $results = $account;
156
 
157
+ } catch ( Exception $e ) {
 
158
 
159
  return $this->toJSON( array( 'error' => $e->getMessage() ) );
160
 
174
 
175
  try {
176
 
177
+ if ( ! $_POST['data']['api_key'] || empty( $_POST['data']['api_key'] ) ) {
178
 
179
  return $this->toJSON( array( '' => __( 'Enter your api key above to see your lists', 'woocommerce-mailchimp' ) ) );
180
 
184
 
185
  $lists = $this->sswcmc->mailchimp( $api_key )->get_lists();
186
 
187
+ $results = array_merge( array( '' => 'Select a list...' ), $lists );
188
 
189
+ } catch ( Exception $e ) {
 
190
 
191
  return $this->toJSON( array( 'error' => $e->getMessage() ) );
192
 
206
 
207
  try {
208
 
209
+ if ( ! $_POST['data']['api_key'] || empty( $_POST['data']['api_key'] ) ) {
210
 
211
  return $this->toJSON( array( '' => __( 'Enter your api key above to see your lists', 'ss_wc_mailchimp' ) ) );
212
 
213
  }
214
 
215
+ if ( ! $_POST['data']['list_id'] || empty( $_POST['data']['list_id'] ) ) {
216
 
217
  return $this->toJSON( array( '' => __( 'Please select a list from above.', 'ss_wc_mailchimp' ) ) );
218
 
225
 
226
  $results = $interest_groups;
227
 
228
+ } catch ( Exception $e ) {
 
229
 
230
  return $this->toJSON( array( 'error' => $e->getMessage() ) );
231
 
349
 
350
  $interest_groups = $this->sswcmc->interest_groups();
351
 
352
+ if ( ! empty( $interest_groups ) ) {
353
  $interest_groups = array_fill_keys( $this->sswcmc->interest_groups(), true );
354
 
355
  // Allow hooking into variables.
370
  );
371
 
372
  // Allow hooking into subscription options.
373
+ $options = apply_filters( 'ss_wc_mailchimp_subscribe_options', $subscribe_options, $order_id );
374
 
375
  // Extract options into variables.
376
  extract( $options );
includes/class-ss-wc-mailchimp-plugin.php CHANGED
@@ -15,7 +15,7 @@ final class SS_WC_MailChimp_Plugin {
15
  *
16
  * @var string
17
  */
18
- private static $version = '2.1.13';
19
 
20
  /**
21
  * Plugin singleton instance
@@ -390,6 +390,8 @@ final class SS_WC_MailChimp_Plugin {
390
 
391
  add_filter( 'plugin_action_links_' . plugin_basename( SS_WC_MAILCHIMP_FILE ), array( $this, 'action_links' ) );
392
 
 
 
393
  add_filter( 'woocommerce_get_settings_pages', array( $this, 'add_mailchimp_settings' ) );
394
 
395
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
@@ -458,6 +460,32 @@ final class SS_WC_MailChimp_Plugin {
458
 
459
  } //end function action_links
460
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
461
  /**
462
  * Add the MailChimp settings tab to WooCommerce
463
  *
15
  *
16
  * @var string
17
  */
18
+ private static $version = '2.1.14';
19
 
20
  /**
21
  * Plugin singleton instance
390
 
391
  add_filter( 'plugin_action_links_' . plugin_basename( SS_WC_MAILCHIMP_FILE ), array( $this, 'action_links' ) );
392
 
393
+ //add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
394
+
395
  add_filter( 'woocommerce_get_settings_pages', array( $this, 'add_mailchimp_settings' ) );
396
 
397
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
460
 
461
  } //end function action_links
462
 
463
+ /**
464
+ * Show row meta on the plugin screen.
465
+ *
466
+ * @param mixed $links Plugin Row Meta.
467
+ * @param mixed $file Plugin Base file.
468
+ *
469
+ * @return array
470
+ */
471
+ public static function plugin_row_meta( $links, $file ) {
472
+ if ( plugin_basename( SS_WC_MAILCHIMP_FILE ) === $file ) {
473
+ $row_meta = array(
474
+ 'docs' => '<a href="' . esc_url( apply_filters( 'ss_wc_mailchimp_docs_url', 'https://docs.woocommerce.com/documentation/plugins/woocommerce/' ) ) . '" aria-label="' . esc_attr__( 'View WooCommerce MailChimp documentation', 'woocommerce-mailchimp' ) . '">' . esc_html__( 'Documentation', 'woocommerce-mailchimp' ) . '</a>',
475
+ );
476
+
477
+ if ( ! function_exists( 'SSWCMCPRO' ) ) {
478
+ $$row_meta[] = array(
479
+ 'support' => '<a href="' . esc_url( apply_filters( 'ss_wc_mailchimp_support_url', 'https://www.saintsystems.com/products/woocommerce-mailchimp-pro/#utm_source=wp-plugin&utm_medium=woocommerce-mailchimp&utm_campaign=plugins-upgrade-link' ) ) . '" aria-label="' . esc_attr__( 'Upgrade to WooCommerce MailChimp Pro', 'woocommerce-mailchimp' ) . '" target="_blank">' . esc_html__( 'Upgrade to Pro', 'woocommerce-mailchimp' ) . '</a>',
480
+ );
481
+ }
482
+
483
+ return array_merge( $row_meta, $links );
484
+ }
485
+
486
+ return (array) $links;
487
+ }
488
+
489
  /**
490
  * Add the MailChimp settings tab to WooCommerce
491
  *
includes/class-ss-wc-mailchimp.php CHANGED
@@ -277,7 +277,7 @@ class SS_WC_MailChimp {
277
 
278
  $resource = "lists/$list_id/interest-categories";
279
 
280
- $response = $this->api->get( $resource );
281
 
282
  if ( ! $response ) {
283
  return false;
@@ -315,7 +315,7 @@ class SS_WC_MailChimp {
315
 
316
  $resource = "lists/$list_id/interest-categories/$interest_category_id/interests";
317
 
318
- $response = $this->api->get( $resource );
319
 
320
  if ( ! $response ) {
321
  return false;
277
 
278
  $resource = "lists/$list_id/interest-categories";
279
 
280
+ $response = $this->api->get( $resource, array( 'count' => 100 ) );
281
 
282
  if ( ! $response ) {
283
  return false;
315
 
316
  $resource = "lists/$list_id/interest-categories/$interest_category_id/interests";
317
 
318
+ $response = $this->api->get( $resource, array( 'count' => 100 ) );
319
 
320
  if ( ! $response ) {
321
  return false;
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: woocommerce, mailchimp
5
  Requires at least: 3.5.1
6
  Tested up to: 5.0.3
7
  WC tested up to: 3.5.4
8
- Stable tag: 2.1.13
9
  License: GPLv3
10
 
11
  Simple and flexible MailChimp integration for WooCommerce.
@@ -114,6 +114,9 @@ Also, if you enjoy using the software [we'd love it if you could give us a revie
114
 
115
  == Changelog ==
116
 
 
 
 
117
  #### 2.1.13 - January 29, 2019
118
  - WooCommerce tested up to 3.5.4
119
  - WP tested up to 5.0.3
5
  Requires at least: 3.5.1
6
  Tested up to: 5.0.3
7
  WC tested up to: 3.5.4
8
+ Stable tag: 2.1.14
9
  License: GPLv3
10
 
11
  Simple and flexible MailChimp integration for WooCommerce.
114
 
115
  == Changelog ==
116
 
117
+ #### 2.1.14 - February 5, 2019
118
+ - Fix MailChimp interest group limit
119
+
120
  #### 2.1.13 - January 29, 2019
121
  - WooCommerce tested up to 3.5.4
122
  - WP tested up to 5.0.3
woocommerce-mailchimp.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: WooCommerce MailChimp provides simple MailChimp integration for WooCommerce.
6
  * Author: Saint Systems
7
  * Author URI: https://www.saintsystems.com
8
- * Version: 2.1.13
9
  * WC tested up to: 3.5.4
10
  * Text Domain: woocommerce-mailchimp
11
  * Domain Path: languages
@@ -41,4 +41,4 @@ function SSWCMC() {
41
  }
42
 
43
  // Get WooCommerce Mailchimp Running.
44
- add_action('plugins_loaded', 'SSWCMC', 11);
5
  * Description: WooCommerce MailChimp provides simple MailChimp integration for WooCommerce.
6
  * Author: Saint Systems
7
  * Author URI: https://www.saintsystems.com
8
+ * Version: 2.1.14
9
  * WC tested up to: 3.5.4
10
  * Text Domain: woocommerce-mailchimp
11
  * Domain Path: languages
41
  }
42
 
43
  // Get WooCommerce Mailchimp Running.
44
+ add_action( 'plugins_loaded', 'SSWCMC', 11 );