Version Description
Download this release
Release Info
Developer | anderly |
Plugin | WooCommerce MailChimp |
Version | 2.0.19 |
Comparing to | |
See all releases |
Code changes from version 2.0.18 to 2.0.19
- includes/class-ss-wc-mailchimp-plugin.php +1 -1
- includes/class-ss-wc-mailchimp.php +52 -2
- readme.txt +5 -1
- woocommerce-mailchimp.php +1 -1
includes/class-ss-wc-mailchimp-plugin.php
CHANGED
@@ -9,7 +9,7 @@ final class SS_WC_MailChimp_Plugin {
|
|
9 |
* Plugin version
|
10 |
* @var string
|
11 |
*/
|
12 |
-
private static $version = '2.0.
|
13 |
|
14 |
/**
|
15 |
* Plugin singleton instance
|
9 |
* Plugin version
|
10 |
* @var string
|
11 |
*/
|
12 |
+
private static $version = '2.0.19';
|
13 |
|
14 |
/**
|
15 |
* Plugin singleton instance
|
includes/class-ss-wc-mailchimp.php
CHANGED
@@ -102,7 +102,39 @@ class SS_WC_MailChimp {
|
|
102 |
|
103 |
} //end function get_lists
|
104 |
|
105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
|
107 |
$args = array(
|
108 |
'email_address' => $email_address,
|
@@ -115,7 +147,14 @@ class SS_WC_MailChimp {
|
|
115 |
$args['interests'] = $interests;
|
116 |
}
|
117 |
|
118 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
|
120 |
$resource = "lists/$list_id/members/$subscriber_hash";
|
121 |
|
@@ -129,6 +168,17 @@ class SS_WC_MailChimp {
|
|
129 |
|
130 |
} //end function subscribe
|
131 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
/**
|
133 |
* Get merge fields
|
134 |
*
|
102 |
|
103 |
} //end function get_lists
|
104 |
|
105 |
+
/**
|
106 |
+
* Get Subscriber
|
107 |
+
* @param string $list_id The MailChimp list ID
|
108 |
+
* @param string $email_address The user's email address
|
109 |
+
* @return string The status of the subscriber
|
110 |
+
*/
|
111 |
+
public function get_subscriber_status( $list_id, $email_address ) {
|
112 |
+
|
113 |
+
$subscriber_hash = $this->get_subscriber_hash( $email_address );
|
114 |
+
|
115 |
+
$resource = "lists/$list_id/members/$subscriber_hash";
|
116 |
+
|
117 |
+
$response = $this->api->get( $resource, array() );
|
118 |
+
|
119 |
+
if ( ! $response ) {
|
120 |
+
return false;
|
121 |
+
}
|
122 |
+
|
123 |
+
return $response['status'];
|
124 |
+
|
125 |
+
} //end function get_subscriber_status
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Subscribe the user to the list
|
129 |
+
* @param string $list_id The MailChimp list ID
|
130 |
+
* @param string $email_address The user's email address
|
131 |
+
* @param string $email_type html|text
|
132 |
+
* @param array $merge_fields Array of MailChimp Merge Tags
|
133 |
+
* @param array $interests Array of MailChimp Interest Groups
|
134 |
+
* @param boolean $double_opt_in Whether to send a double opt-in email to confirm subscription
|
135 |
+
* @return mixed $response The MailChimp API response
|
136 |
+
*/
|
137 |
+
public function subscribe( $list_id, $email_address, $email_type, $merge_fields, $interests, $double_opt_in ) {
|
138 |
|
139 |
$args = array(
|
140 |
'email_address' => $email_address,
|
147 |
$args['interests'] = $interests;
|
148 |
}
|
149 |
|
150 |
+
$subscriber_status = $this->get_subscriber_status( $list_id, $email_address );
|
151 |
+
|
152 |
+
// If the user is already subscribed, bypass the double opt-in email
|
153 |
+
if ( 'subscribed' === $subscriber_status ) {
|
154 |
+
$args['status'] = 'subscribed';
|
155 |
+
}
|
156 |
+
|
157 |
+
$subscriber_hash = $this->get_subscriber_hash( $email_address );
|
158 |
|
159 |
$resource = "lists/$list_id/members/$subscriber_hash";
|
160 |
|
168 |
|
169 |
} //end function subscribe
|
170 |
|
171 |
+
/**
|
172 |
+
* Returns the MD5 hash of the email
|
173 |
+
* @param string $email_address The email address to hash
|
174 |
+
* @return string MD5 hash of the lower-cased email address
|
175 |
+
*/
|
176 |
+
public function get_subscriber_hash( $email_address ) {
|
177 |
+
|
178 |
+
return md5( strtolower( $email_address ) );
|
179 |
+
|
180 |
+
} //end function get_subscriber_hash
|
181 |
+
|
182 |
/**
|
183 |
* Get merge fields
|
184 |
*
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://ssms.us/hVdk
|
|
4 |
Tags: woocommerce, mailchimp
|
5 |
Requires at least: 3.5.1
|
6 |
Tested up to: 4.6.1
|
7 |
-
Stable tag: 2.0.
|
8 |
License: GPLv3
|
9 |
|
10 |
Simple and flexible MailChimp integration for WooCommerce.
|
@@ -115,6 +115,10 @@ Also, if you enjoy using the software [we'd love it if you could give us a revie
|
|
115 |
|
116 |
**IMPORTANT:** You must upgrade to version 2.X by December 31, 2016 as prior versions of the MailChimp API will stop working at that point.
|
117 |
|
|
|
|
|
|
|
|
|
118 |
#### 2.0.18 - September 23, 2016
|
119 |
|
120 |
- Fix for array_filter not working with lamda for some users.
|
4 |
Tags: woocommerce, mailchimp
|
5 |
Requires at least: 3.5.1
|
6 |
Tested up to: 4.6.1
|
7 |
+
Stable tag: 2.0.19
|
8 |
License: GPLv3
|
9 |
|
10 |
Simple and flexible MailChimp integration for WooCommerce.
|
115 |
|
116 |
**IMPORTANT:** You must upgrade to version 2.X by December 31, 2016 as prior versions of the MailChimp API will stop working at that point.
|
117 |
|
118 |
+
#### 2.0.19 - October 4, 2016
|
119 |
+
|
120 |
+
- Fix to not send double opt-in email to existing subscribers.
|
121 |
+
|
122 |
#### 2.0.18 - September 23, 2016
|
123 |
|
124 |
- Fix for array_filter not working with lamda for some users.
|
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.0.
|
9 |
* Text Domain: woocommerce-mailchimp
|
10 |
* Domain Path: languages
|
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.0.19
|
9 |
* Text Domain: woocommerce-mailchimp
|
10 |
* Domain Path: languages
|
11 |
*
|