Changeset 1800792
- Timestamp:
- 01/10/2018 08:42:32 PM (8 years ago)
- Location:
- mailchimp-for-woocommerce/trunk
- Files:
-
- 13 edited
-
README.txt (modified) (2 diffs)
-
admin/class-mailchimp-woocommerce-admin.php (modified) (1 diff)
-
admin/partials/mailchimp-woocommerce-admin-tabs.php (modified) (1 diff)
-
admin/partials/tabs/newsletter_settings.php (modified) (4 diffs)
-
admin/partials/tabs/store_sync.php (modified) (1 diff)
-
includes/api/class-mailchimp-woocommerce-transform-orders-wc3.php (modified) (1 diff)
-
includes/api/class-mailchimp-woocommerce-transform-orders.php (modified) (2 diffs)
-
includes/class-mailchimp-woocommerce-newsletter.php (modified) (2 diffs)
-
includes/class-mailchimp-woocommerce-service.php (modified) (4 diffs)
-
includes/processes/class-mailchimp-woocommerce-process-orders.php (modified) (1 diff)
-
includes/processes/class-mailchimp-woocommerce-user-submit.php (modified) (1 diff)
-
includes/vendor/queue/classes/worker/wp-http-worker.php (modified) (1 diff)
-
mailchimp-woocommerce.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mailchimp-for-woocommerce/trunk/README.txt
r1772672 r1800792 25 25 - Add discount codes created in WooCommerce to your emails and automations with a Promo Code content block 26 26 27 ### A note for current WooCommerce integration users27 ###Important Notes 28 28 This plugin supports our most powerful API 3.0 features, and is intended for users who have not yet integrated their WooCommerce stores with MailChimp. 29 29 30 30 You can run this new integration at the same time as your current WooCommerce integration for MailChimp. However, data from the older integration will display separately in subscriber profiles, and can’t be used with e-commerce features that require API 3.0. 31 32 This plugin is not compatible for WordPress.com users at this time. 31 33 32 34 == Installation == … … 51 53 52 54 == Changelog == 55 56 = 2.1.3 = 57 * Fix subscriber status for repeat transactional customers to stay transactional. 58 * Remove shipping and billing address requirements for order submission. 59 * Do not unsubscribe someone who has previously subscribed when unchecking the newsletter sign up box. 60 * Update newsletter checkbox style to be consistent with WooCommerce styles. 61 * Make sure WooCommerce plugin is running before running any plugin code. 62 * Fix compatibility issue with WP-Cron 53 63 54 64 = 2.1.2 = -
mailchimp-for-woocommerce/trunk/admin/class-mailchimp-woocommerce-admin.php
r1772672 r1800792 293 293 unset($data['mailchimp_api_key']); 294 294 $valid = false; 295 if (!$profile) { 296 add_settings_error('mailchimp_store_settings', '', 'API Key Invalid'); 297 } 295 298 } 296 299 -
mailchimp-for-woocommerce/trunk/admin/partials/mailchimp-woocommerce-admin-tabs.php
r1762067 r1800792 134 134 <h2 style="padding-top: 1em;">More Information</h2> 135 135 <p> 136 Need help troubleshooting or connecting your store? Visit our MailChimp for WooCommerce 137 <a href="http://kb.mailchimp.com/integrations/e-commerce/connect-or-disconnect-mailchimp-for-woocommerce/" target="_blank">knowledge base</a> at anytime. Also, be sure to 138 <a href="https://wordpress.org/support/plugin/mailchimp-for-woocommerce/reviews/" target="_blank">leave a review</a> and let us know how we're doing. 136 Need help to connect your store? Visit the MailChimp 137 <a href="http://kb.mailchimp.com/integrations/e-commerce/connect-or-disconnect-mailchimp-for-woocommerce/" target="_blank">Knowledge Base</a>.<br/> 138 Want to tell us how we're doing? 139 <a href="https://wordpress.org/support/plugin/mailchimp-for-woocommerce/reviews/" target="_blank">Leave a review on Wordpress.org</a>. 139 140 </p> 140 141 <?php endif; ?> -
mailchimp-for-woocommerce/trunk/admin/partials/tabs/newsletter_settings.php
r1735785 r1800792 83 83 84 84 <h2 style="padding-top: 1em;">Opt-in Settings</h2> 85 <p>Add text to go along with the opt-in checkbox, and choose a default display option. </p>85 <p>Add text to go along with the opt-in checkbox, and choose a default display option. Customers can click a box at checkout to opt in to your newsletter. Write a signup message and choose how you want this checkbox to appear. </p> 86 86 87 87 <fieldset> … … 91 91 <label for="<?php echo $this->plugin_name; ?>-newsletter-checkbox-label"> 92 92 <input style="width: 30%;" type="text" id="<?php echo $this->plugin_name; ?>-newsletter-checkbox-label" name="<?php echo $this->plugin_name; ?>[newsletter_label]" value="<?php echo isset($options['newsletter_label']) ? $options['newsletter_label'] : 'Subscribe to our newsletter' ?>" /> 93 <span><?php esc_attr_e(' Write a subscribe message for customers at checkout.', $this->plugin_name); ?></span>93 <span><?php esc_attr_e('Enter text for the opt-in checkbox', $this->plugin_name); ?></span> 94 94 </label> 95 95 </fieldset> 96 96 97 <h 2 style="padding-top: 1em;">Checkbox Display Options</h2>97 <h4 style="padding-top: 1em;font-weight:normal;">Checkbox Display Options</h4> 98 98 99 99 <fieldset> … … 105 105 <input type="radio" name="<?php echo $this->plugin_name; ?>[mailchimp_checkbox_defaults]" value="check"<?php if($checkbox_default_settings === 'check') echo ' checked="checked" '; ?>>Visible, checked by default<br> 106 106 <input type="radio" name="<?php echo $this->plugin_name; ?>[mailchimp_checkbox_defaults]" value="uncheck"<?php if($checkbox_default_settings === 'uncheck') echo ' checked="checked" '; ?>>Visible, unchecked by default<br/> 107 <input type="radio" name="<?php echo $this->plugin_name; ?>[mailchimp_checkbox_defaults]" value="hide"<?php if($checkbox_default_settings === 'hide') echo ' checked="checked" '; ?>>Hidden, not opted by default<br/>107 <input type="radio" name="<?php echo $this->plugin_name; ?>[mailchimp_checkbox_defaults]" value="hide"<?php if($checkbox_default_settings === 'hide') echo ' checked="checked" '; ?>>Hidden, unchecked by default<br/> 108 108 </label> 109 109 </fieldset> 110 110 111 <h 2 style="padding-top: 1em;">Advanced Checkbox Settings</h2>111 <h4 style="padding-top: 1em;font-weight:normal;">Advanced Checkbox Settings</h4> 112 112 <p> 113 113 To change the location of the opt-in checkbox at checkout, input one of the … … 123 123 <label for="<?php echo $this->plugin_name; ?>-newsletter-checkbox-action"> 124 124 <input style="width: 30%;" type="text" id="<?php echo $this->plugin_name; ?>-newsletter-checkbox-action" name="<?php echo $this->plugin_name; ?>[mailchimp_checkbox_action]" value="<?php echo isset($options['mailchimp_checkbox_action']) ? $options['mailchimp_checkbox_action'] : 'woocommerce_after_checkout_billing_form' ?>" /> 125 <span><?php esc_attr_e(' WooCommerce Action', $this->plugin_name); ?></span>125 <span><?php esc_attr_e('Enter a WooCommerce form action', $this->plugin_name); ?></span> 126 126 </label> 127 127 </fieldset> -
mailchimp-for-woocommerce/trunk/admin/partials/tabs/store_sync.php
r1557758 r1800792 71 71 <h2 style="padding-top: 1em;">Advanced</h2> 72 72 <p> 73 You may sync your list again if necessary. When this is done, all ecommerce data will be reset in your MailChimp list - including products and transactiondata.73 You can resync your list at any time without losing any of your e-commerce data. 74 74 </p> 75 75 <?php submit_button('Resync', 'primary','submit', TRUE); ?> -
mailchimp-for-woocommerce/trunk/includes/api/class-mailchimp-woocommerce-transform-orders-wc3.php
r1772672 r1800792 187 187 try { 188 188 $subscriber = mailchimp_get_api()->member(mailchimp_get_list_id(), $customer->getEmailAddress()); 189 $customer->setOptInStatus(($subscriber['status'] !== 'unsubscribed')); 189 $status = !in_array($subscriber['status'], array('unsubscribed', 'transactional')); 190 $customer->setOptInStatus($status); 190 191 } catch (\Exception $e) {} 191 192 } -
mailchimp-for-woocommerce/trunk/includes/api/class-mailchimp-woocommerce-transform-orders.php
r1762067 r1800792 170 170 171 171 // apply the coupon discounts 172 if ( ($used_coupons = $woo->get_used_coupons()) && is_array($used_coupons)) {172 if (function_exists('wc_get_coupon_id_by_code') && ($used_coupons = $woo->get_used_coupons()) && is_array($used_coupons)) { 173 173 foreach ($used_coupons as $coupon_code) { 174 174 if (($coupon_id = wc_get_coupon_id_by_code($coupon_code))) { … … 213 213 try { 214 214 $subscriber = mailchimp_get_api()->member(mailchimp_get_list_id(), $customer->getEmailAddress()); 215 $customer->setOptInStatus(($subscriber['status'] !== 'unsubscribed')); 215 $status = !in_array($subscriber['status'], array('unsubscribed', 'transactional')); 216 $customer->setOptInStatus($status); 216 217 } catch (\Exception $e) {} 217 218 } -
mailchimp-for-woocommerce/trunk/includes/class-mailchimp-woocommerce-newsletter.php
r1709699 r1800792 42 42 // echo out the checkbox. 43 43 $checkbox = '<p class="form-row form-row-wide create-account">'; 44 $checkbox .= '<input class="input-checkbox" id="mailchimp_woocommerce_newsletter" type="checkbox" '; 45 $checkbox .= 'name="mailchimp_woocommerce_newsletter" value="1"'.($status ? ' checked="checked"' : '').'>'; 46 $checkbox .= '<label for="mailchimp_woocommerce_newsletter" class="checkbox">'.$label.'</label></p>'; 44 $checkbox .= '<label for="mailchimp_woocommerce_newsletter" class="woocommerce-form__label woocommerce-form__label-for-checkbox checkbox">'; 45 $checkbox .= '<input class="woocommerce-form__input woocommerce-form__input-checkbox input-checkbox" id="mailchimp_woocommerce_newsletter" type="checkbox" '; 46 $checkbox .= 'name="mailchimp_woocommerce_newsletter" value="1"'.($status ? ' checked="checked"' : '').'> '; 47 $checkbox .= '<span>' . $label . '</span>'; 48 $checkbox .= '</label>'; 49 $checkbox .= '</p>'; 47 50 $checkbox .= '<div class="clear"></div>'; 48 51 … … 75 78 public function processRegistrationForm($sanitized_user_login, $user_email, $reg_errors) 76 79 { 77 78 80 if (defined('WOOCOMMERCE_CHECKOUT')) { 79 81 return; // Ship checkout 80 82 } 83 81 84 $this->handleStatus(); 82 85 } -
mailchimp-for-woocommerce/trunk/includes/class-mailchimp-woocommerce-service.php
r1772672 r1800792 326 326 { 327 327 if (!($this->cart = $this->getWooSession('cart', false))) { 328 $this->cart = WC()->cart->get_cart();328 $this->cart = function_exists('WC') ? false : WC()->cart->get_cart(); 329 329 } else { 330 330 $cart_session = array(); … … 504 504 public function getWooSession($key, $default = null) 505 505 { 506 if (!function_exists('WC')) return $default; 507 506 508 if (!($woo = WC()) || empty($woo->session)) { 507 509 return $default; … … 517 519 public function setWooSession($key, $value) 518 520 { 521 if (!function_exists('WC')) return $this; 522 519 523 if (!($woo = WC()) || empty($woo->session)) { 520 524 return $this; … … 532 536 public function removeWooSession($key) 533 537 { 538 if (!function_exists('WC')) return $this; 539 534 540 if (!($woo = WC()) || empty($woo->session)) { 535 541 return $this; -
mailchimp-for-woocommerce/trunk/includes/processes/class-mailchimp-woocommerce-process-orders.php
r1772672 r1800792 39 39 try { 40 40 $subscriber = $this->mailchimp()->member(mailchimp_get_list_id(), $item->getCustomer()->getEmailAddress()); 41 $status = $subscriber['status'] !== 'unsubscribed';41 $status = !in_array($subscriber['status'], array('unsubscribed', 'transactional')); 42 42 } catch (\Exception $e) { 43 43 $status = (bool) $this->getOption('mailchimp_auto_subscribe', true); -
mailchimp-for-woocommerce/trunk/includes/processes/class-mailchimp-woocommerce-user-submit.php
r1762067 r1800792 85 85 } 86 86 87 // don't let anyone be unsubscribed from the list - that should only happen on email campaigns 88 // and someone clicking the unsubscribe linkage. 89 if (!$this->subscribed) { 90 return false; 91 } 92 87 93 $api = new MailChimp_WooCommerce_MailChimpApi($api_key); 88 94 -
mailchimp-for-woocommerce/trunk/includes/vendor/queue/classes/worker/wp-http-worker.php
r1509499 r1800792 254 254 } 255 255 256 /** 257 * Handle cron 258 * 259 * Restart the HTTP worker if not already running 260 * and data exists in the queue. 261 */ 262 public function handle_cron() { 263 if ( $this->is_worker_running() ) { 264 // Worker already running, die 265 wp_die(); 266 } 267 268 if ( ! $this->queue->available_jobs() ) { 269 // No jobs on the queue to process, die 270 wp_die(); 271 } 272 273 $this->dispatch(); 274 275 exit; 276 } 256 /** 257 * @return bool 258 */ 259 public function handle_cron() { 260 if ($this->is_worker_running()) { 261 wp_die(); 262 } 263 264 if ($this->queue->available_jobs()) { 265 $this->dispatch(); 266 return true; 267 } 268 269 return false; 270 } 277 271 278 272 /** -
mailchimp-for-woocommerce/trunk/mailchimp-woocommerce.php
r1772672 r1800792 17 17 * Plugin URI: https://mailchimp.com/connect-your-store/ 18 18 * Description: MailChimp - WooCommerce plugin 19 * Version: 2.1. 219 * Version: 2.1.3 20 20 * Author: MailChimp 21 21 * Author URI: https://mailchimp.com … … 44 44 'repo' => 'master', 45 45 'environment' => 'production', 46 'version' => '2.1. 2',46 'version' => '2.1.3', 47 47 'wp_version' => (empty($wp_version) ? 'Unknown' : $wp_version), 48 48 'wc_version' => class_exists('WC') ? WC()->version : null, … … 166 166 } 167 167 foreach ($data as $key => $value) { 168 if ($value === null || $value === '' ) {168 if ($value === null || $value === '' || (is_array($value) && empty($value))) { 169 169 unset($data[$key]); 170 170 } … … 193 193 194 194 /** 195 * @return bool 196 */ 197 function mailchimp_check_woocommerce_plugin_status() 198 { 199 if (defined("RUNNING_CUSTOM_WOOCOMMERCE") && RUNNING_CUSTOM_WOOCOMMERCE === true) return true; 200 return in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option('active_plugins'))); 201 } 202 203 /** 195 204 * The code that runs during plugin activation. 196 205 * This action is documented in includes/class-mailchimp-woocommerce-activator.php … … 198 207 function activate_mailchimp_woocommerce() { 199 208 // if we don't have woocommerce we need to display a horrible error message before the plugin is installed. 200 if (!is_plugin_active('woocommerce/woocommerce.php')) { 201 202 $active = false; 203 204 // some people may have uploaded a specific version of woo, so we need a fallback checker here. 205 foreach (array_keys(get_plugins()) as $plugin) { 206 if (mailchimp_string_contains($plugin, 'woocommerce.php')) { 207 $active = true; 208 break; 209 } 210 } 211 212 if (!$active) { 213 // Deactivate the plugin 214 deactivate_plugins(__FILE__); 215 $error_message = __('The MailChimp For WooCommerce plugin requires the <a href="http://wordpress.org/extend/plugins/woocommerce/">WooCommerce</a> plugin to be active!', 'woocommerce'); 216 wp_die($error_message); 217 } 209 if (!mailchimp_check_woocommerce_plugin_status()) { 210 // Deactivate the plugin 211 deactivate_plugins(__FILE__); 212 $error_message = __('The MailChimp For WooCommerce plugin requires the <a href="http://wordpress.org/extend/plugins/woocommerce/">WooCommerce</a> plugin to be active!', 'woocommerce'); 213 wp_die($error_message); 218 214 } 219 215 … … 444 440 } 445 441 446 add_action('wp_head', 'mailchimp_woocommerce_add_meta_tags'); 447 448 /** Add all the MailChimp hooks. */ 449 run_mailchimp_woocommerce(); 442 if (mailchimp_check_woocommerce_plugin_status()) { 443 add_action('wp_head', 'mailchimp_woocommerce_add_meta_tags'); 444 /** Add all the MailChimp hooks. */ 445 run_mailchimp_woocommerce(); 446 }
Note: See TracChangeset
for help on using the changeset viewer.