WooCommerce MailChimp - Version 2.1.18

Version Description

Download this release

Release Info

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

Code changes from version 2.1.17 to 2.1.18

includes/class-ss-wc-mailchimp-api.php CHANGED
@@ -176,7 +176,7 @@ class SS_WC_MailChimp_API {
176
 
177
  $this->last_response = $raw_response;
178
 
179
- $this->maybe_log( $url, $method, $args, $raw_response );
180
 
181
  if ( is_wp_error( $raw_response ) ) {
182
 
@@ -226,6 +226,11 @@ class SS_WC_MailChimp_API {
226
  * @return void
227
  */
228
  private function maybe_log( $resource, $method, $args, $response ) {
 
 
 
 
 
229
  do_action( 'sswcmc_log', "MailChimp API Call RESOURCE: $resource \n METHOD: $method \n BODY: " . print_r( $args, true ) . " \n RESPONSE: " . print_r( $response, true ) );
230
  }
231
 
176
 
177
  $this->last_response = $raw_response;
178
 
179
+ // $this->maybe_log( $url, $method, $args, $raw_response );
180
 
181
  if ( is_wp_error( $raw_response ) ) {
182
 
226
  * @return void
227
  */
228
  private function maybe_log( $resource, $method, $args, $response ) {
229
+
230
+ if ( isset( $response['_links'] ) ) {
231
+ unset( $response['_links'] );
232
+ }
233
+
234
  do_action( 'sswcmc_log', "MailChimp API Call RESOURCE: $resource \n METHOD: $method \n BODY: " . print_r( $args, true ) . " \n RESPONSE: " . print_r( $response, true ) );
235
  }
236
 
includes/class-ss-wc-mailchimp-handler.php CHANGED
@@ -120,7 +120,7 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
120
 
121
  $list_id = $this->sswcmc->get_list();
122
 
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' );
@@ -330,9 +330,7 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
330
  */
331
  public function maybe_subscribe( $subscribe_customer, $order_id, $first_name, $last_name, $email, $list_id = 'false' ) {
332
 
333
- // throw new Exception('Failure: Houston we have a problem!');
334
-
335
- $this->log( sprintf( __( __METHOD__ . '(): Processing queued maybe_subscribe ($subscribe_customer: %s) for customer (%s) to list %s', 'woocommerce-mailchimp' ), $subscribe_customer, $email, $list_id ) );
336
 
337
  if ( ! $email ) {
338
  return; // Email is required.
@@ -378,7 +376,7 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
378
  // Log.
379
  $this->log( sprintf( __( __METHOD__ . '(): Maybe subscribing customer ($subscribe_customer: %s) to MailChimp: %s', 'woocommerce-mailchimp' ), $subscribe_customer, print_r( $options, true ) ) );
380
 
381
- do_action( 'ss_wc_mailchimp_before_subscribe', $subscribe_options, $order_id );
382
 
383
  // If the 'ss_wc_mailchimp_opt_in' meta value isn't set
384
  // (because 'display_opt_in' wasn't enabled at the time the order was placed)
@@ -411,7 +409,7 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
411
  }
412
  }
413
 
414
- do_action( 'ss_wc_mailchimp_after_subscribe', $subscribe_options, $order_id );
415
 
416
  }
417
 
@@ -459,15 +457,10 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
459
  * @since 1.2.2
460
  */
461
  private function log( $message ) {
462
- if ( $this->sswcmc->debug_enabled() ) {
463
- $logger = new WC_Logger();
464
-
465
- if ( is_array( $message ) || is_object( $message ) ) {
466
- $logger->add( 'woocommerce-mailchimp', print_r( $message, true ) );
467
- }
468
- else {
469
- $logger->add( 'woocommerce-mailchimp', $message );
470
- }
471
  }
472
  }
473
 
120
 
121
  $list_id = $this->sswcmc->get_list();
122
 
123
+ $this->log( sprintf( __( __METHOD__ . '(): Queueing maybe subscribe ($subscribe_customer: %s) for customer (%s) to list %s for order (%s)', 'woocommerce-mailchimp'), $subscribe_customer, $order_billing_email, $list_id, $order_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' );
330
  */
331
  public function maybe_subscribe( $subscribe_customer, $order_id, $first_name, $last_name, $email, $list_id = 'false' ) {
332
 
333
+ $this->log( sprintf( __( __METHOD__ . '(): Processing queued maybe_subscribe ($subscribe_customer: %s) for customer (%s) to list %s for order (%s)', 'woocommerce-mailchimp' ), $subscribe_customer, $email, $list_id, $order_id ) );
 
 
334
 
335
  if ( ! $email ) {
336
  return; // Email is required.
376
  // Log.
377
  $this->log( sprintf( __( __METHOD__ . '(): Maybe subscribing customer ($subscribe_customer: %s) to MailChimp: %s', 'woocommerce-mailchimp' ), $subscribe_customer, print_r( $options, true ) ) );
378
 
379
+ do_action( 'ss_wc_mailchimp_before_subscribe', $subscribe_customer, $subscribe_options, $order_id );
380
 
381
  // If the 'ss_wc_mailchimp_opt_in' meta value isn't set
382
  // (because 'display_opt_in' wasn't enabled at the time the order was placed)
409
  }
410
  }
411
 
412
+ do_action( 'ss_wc_mailchimp_after_subscribe', $subscribe_customer, $subscribe_options, $order_id );
413
 
414
  }
415
 
457
  * @since 1.2.2
458
  */
459
  private function log( $message ) {
460
+ if ( is_array( $message ) || is_object( $message ) ) {
461
+ do_action( 'sswcmc_log', print_r( $message, true ) );
462
+ } else {
463
+ do_action( 'sswcmc_log', $message );
 
 
 
 
 
464
  }
465
  }
466
 
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.17';
19
 
20
  /**
21
  * Plugin singleton instance
15
  *
16
  * @var string
17
  */
18
+ private static $version = '2.1.18';
19
 
20
  /**
21
  * Plugin singleton instance
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: saintsystems, anderly
3
  Donate link: http://ssms.us/hVdk
4
  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.17
9
  License: GPLv3
10
 
11
  Simple and flexible MailChimp integration for WooCommerce.
@@ -114,6 +114,11 @@ 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.17 - February 14, 2019
118
  - Allow html (hyperlinks, etc.) in Opt-In Field Label.
119
 
3
  Donate link: http://ssms.us/hVdk
4
  Tags: woocommerce, mailchimp
5
  Requires at least: 3.5.1
6
+ Tested up to: 5.1
7
  WC tested up to: 3.5.4
8
+ Stable tag: 2.1.18
9
  License: GPLv3
10
 
11
  Simple and flexible MailChimp integration for WooCommerce.
114
 
115
  == Changelog ==
116
 
117
+ #### 2.1.18 - February 15, 2019
118
+ - Add subscribe_customer param to before/after subscribe hooks.
119
+ - Use new logging action for logging.
120
+ - Update tested to WP 5.1
121
+
122
  #### 2.1.17 - February 14, 2019
123
  - Allow html (hyperlinks, etc.) in Opt-In Field Label.
124
 
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.17
9
  * WC tested up to: 3.5.4
10
  * Text Domain: woocommerce-mailchimp
11
  * Domain Path: languages
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.18
9
  * WC tested up to: 3.5.4
10
  * Text Domain: woocommerce-mailchimp
11
  * Domain Path: languages