Plugin Directory

Changeset 1800792


Ignore:
Timestamp:
01/10/2018 08:42:32 PM (8 years ago)
Author:
MailChimp
Message:

Update to 2.1.3. Bug fixes (see readme changelog).

Location:
mailchimp-for-woocommerce/trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • mailchimp-for-woocommerce/trunk/README.txt

    r1772672 r1800792  
    2525- Add discount codes created in WooCommerce to your emails and automations with a Promo Code content block
    2626
    27 ###A note for current WooCommerce integration users
     27###Important Notes
    2828This plugin supports our most powerful API 3.0 features, and is intended for users who have not yet integrated their WooCommerce stores with MailChimp.
    2929
    3030You 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
     32This plugin is not compatible for WordPress.com users at this time.
    3133
    3234== Installation ==
     
    5153
    5254== 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
    5363
    5464= 2.1.2 =
  • mailchimp-for-woocommerce/trunk/admin/class-mailchimp-woocommerce-admin.php

    r1772672 r1800792  
    293293            unset($data['mailchimp_api_key']);
    294294            $valid = false;
     295            if (!$profile) {
     296                add_settings_error('mailchimp_store_settings', '', 'API Key Invalid');
     297            }
    295298        }
    296299
  • mailchimp-for-woocommerce/trunk/admin/partials/mailchimp-woocommerce-admin-tabs.php

    r1762067 r1800792  
    134134        <h2 style="padding-top: 1em;">More Information</h2>
    135135        <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>.
    139140        </p>
    140141    <?php endif; ?>
  • mailchimp-for-woocommerce/trunk/admin/partials/tabs/newsletter_settings.php

    r1735785 r1800792  
    8383
    8484<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>
    8686
    8787<fieldset>
     
    9191    <label for="<?php echo $this->plugin_name; ?>-newsletter-checkbox-label">
    9292        <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>
    9494    </label>
    9595</fieldset>
    9696
    97 <h2 style="padding-top: 1em;">Checkbox Display Options</h2>
     97<h4 style="padding-top: 1em;font-weight:normal;">Checkbox Display Options</h4>
    9898
    9999<fieldset>
     
    105105        <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>
    106106        <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/>
    108108    </label>
    109109</fieldset>
    110110
    111 <h2 style="padding-top: 1em;">Advanced Checkbox Settings</h2>
     111<h4 style="padding-top: 1em;font-weight:normal;">Advanced Checkbox Settings</h4>
    112112<p>
    113113    To change the location of the opt-in checkbox at checkout, input one of the
     
    123123    <label for="<?php echo $this->plugin_name; ?>-newsletter-checkbox-action">
    124124        <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>
    126126    </label>
    127127</fieldset>
  • mailchimp-for-woocommerce/trunk/admin/partials/tabs/store_sync.php

    r1557758 r1800792  
    7171    <h2 style="padding-top: 1em;">Advanced</h2>
    7272    <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 transaction data.
     73        You can resync your list at any time without losing any of your e-commerce data.
    7474    </p>
    7575    <?php submit_button('Resync', 'primary','submit', TRUE); ?>
  • mailchimp-for-woocommerce/trunk/includes/api/class-mailchimp-woocommerce-transform-orders-wc3.php

    r1772672 r1800792  
    187187            try {
    188188                $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);
    190191            } catch (\Exception $e) {}
    191192        }
  • mailchimp-for-woocommerce/trunk/includes/api/class-mailchimp-woocommerce-transform-orders.php

    r1762067 r1800792  
    170170
    171171        // 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)) {
    173173            foreach ($used_coupons as $coupon_code) {
    174174                if (($coupon_id = wc_get_coupon_id_by_code($coupon_code))) {
     
    213213            try {
    214214                $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);
    216217            } catch (\Exception $e) {}
    217218        }
  • mailchimp-for-woocommerce/trunk/includes/class-mailchimp-woocommerce-newsletter.php

    r1709699 r1800792  
    4242            // echo out the checkbox.
    4343            $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>';
    4750            $checkbox .= '<div class="clear"></div>';
    4851
     
    7578    public function processRegistrationForm($sanitized_user_login, $user_email, $reg_errors)
    7679    {
    77 
    7880        if (defined('WOOCOMMERCE_CHECKOUT')) {
    7981            return; // Ship checkout
    8082        }
     83
    8184        $this->handleStatus();
    8285    }
  • mailchimp-for-woocommerce/trunk/includes/class-mailchimp-woocommerce-service.php

    r1772672 r1800792  
    326326    {
    327327        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();
    329329        } else {
    330330            $cart_session = array();
     
    504504    public function getWooSession($key, $default = null)
    505505    {
     506        if (!function_exists('WC')) return $default;
     507
    506508        if (!($woo = WC()) || empty($woo->session)) {
    507509            return $default;
     
    517519    public function setWooSession($key, $value)
    518520    {
     521        if (!function_exists('WC')) return $this;
     522
    519523        if (!($woo = WC()) || empty($woo->session)) {
    520524            return $this;
     
    532536    public function removeWooSession($key)
    533537    {
     538        if (!function_exists('WC')) return $this;
     539
    534540        if (!($woo = WC()) || empty($woo->session)) {
    535541            return $this;
  • mailchimp-for-woocommerce/trunk/includes/processes/class-mailchimp-woocommerce-process-orders.php

    r1772672 r1800792  
    3939                try {
    4040                    $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'));
    4242                } catch (\Exception $e) {
    4343                    $status = (bool) $this->getOption('mailchimp_auto_subscribe', true);
  • mailchimp-for-woocommerce/trunk/includes/processes/class-mailchimp-woocommerce-user-submit.php

    r1762067 r1800792  
    8585        }
    8686
     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
    8793        $api = new MailChimp_WooCommerce_MailChimpApi($api_key);
    8894
  • mailchimp-for-woocommerce/trunk/includes/vendor/queue/classes/worker/wp-http-worker.php

    r1509499 r1800792  
    254254        }
    255255
    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        }
    277271
    278272        /**
  • mailchimp-for-woocommerce/trunk/mailchimp-woocommerce.php

    r1772672 r1800792  
    1717 * Plugin URI:        https://mailchimp.com/connect-your-store/
    1818 * Description:       MailChimp - WooCommerce plugin
    19  * Version:           2.1.2
     19 * Version:           2.1.3
    2020 * Author:            MailChimp
    2121 * Author URI:        https://mailchimp.com
     
    4444        'repo' => 'master',
    4545        'environment' => 'production',
    46         'version' => '2.1.2',
     46        'version' => '2.1.3',
    4747        'wp_version' => (empty($wp_version) ? 'Unknown' : $wp_version),
    4848        'wc_version' => class_exists('WC') ? WC()->version : null,
     
    166166    }
    167167    foreach ($data as $key => $value) {
    168         if ($value === null || $value === '') {
     168        if ($value === null || $value === '' || (is_array($value) && empty($value))) {
    169169            unset($data[$key]);
    170170        }
     
    193193
    194194/**
     195 * @return bool
     196 */
     197function 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/**
    195204 * The code that runs during plugin activation.
    196205 * This action is documented in includes/class-mailchimp-woocommerce-activator.php
     
    198207function activate_mailchimp_woocommerce() {
    199208    // 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);
    218214    }
    219215
     
    444440}
    445441
    446 add_action('wp_head', 'mailchimp_woocommerce_add_meta_tags');
    447 
    448 /** Add all the MailChimp hooks. */
    449 run_mailchimp_woocommerce();
     442if (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.