Plugin Directory

Changeset 2680885


Ignore:
Timestamp:
02/17/2022 02:24:17 PM (4 years ago)
Author:
rulecom
Message:

Update to version 2.7.0 from GitHub

Location:
woorule
Files:
18 edited
1 copied

Legend:

Unmodified
Added
Removed
  • woorule/tags/2.7.0/README.txt

    r2671567 r2680885  
    33Tags: rule, woocommerce, newsletter, marketing
    44Requires at least: 5.0.0
    5 Tested up to: 5.8.3
     5Tested up to: 5.9
    66Requires PHP: 5.6+
    7 Stable tag: 2.6.0
     7Stable tag: 2.7.0
    88License: MIT
    99License URI: http://opensource.org/licenses/MIT
     
    4141You can embed a Newsletter sign-up form in your posts, or on any page with a simple shortcode `[woorule]`
    4242
    43 You can also customize the sign-up form with any of the following shortcode options:
     43You can also customize the sign-up form with any of the following shortcode attributes:
     44
    4445`
    45 [woorule title="Custom Title" placeholder="Custom Placeholder Text" button="Custom Button Text" success="Custom Success Message" tag="Custom Tag"]
     46[woorule title="Custom Title" placeholder="Custom Placeholder Text" button="Custom Button Text" checkbox="Custom Text Next To Checkbox" success="Custom Success Message" tag="Custom Tag" require_opt_in=false]
    4647`
    47 The `tag` field will be applied to the subscriber when the form is submitted. If no tag field is used a `Newsletter` tag will be applied by default.
     48
     49The `checkbox` attribute will add a checkbox below the signup form. If this attribute is present then checking the checkbox is required before the form can be submitted. This is useful for ensuring the subscriber agrees to your terms before being added to a mailing list.
     50
     51The `tag` attribute will be applied to the subscriber when the form is submitted. If no tag field is used a `Newsletter` tag will be applied by default.
     52
     53The `require_opt_in` attribute, if set to `true`, will require the subscriber to accept an opt-in email before further marketing emails can be sent. The opt-in flow requires you to have a [subscriber form](https://app.rule.io/#/subscriber/subscriber-form) setup in your Rule account in order for the opt-in email to be sent to the subscriber. Note that the `tag` attribute should be the same as the form tag.
     54
    4855
    4956== Frequently Asked Questions ==
     
    101108
    102109For more information, check out our [releases](https://github.com/rulecom/woorule/releases).
     110
     111= 2.7.0 =
     112* Added an optional `checkbox` attribute to the woorule shortcode, which must be checked before the form can be submitted
     113* Added an optional `require_opt_in` attribute to the woorule shortcode, which sends the subscriber an opt-in email before they can received additional marketing emails
     114* Fixed Cart In Progress bug
     115* Improved logging
    103116
    104117= 2.6.0 =
  • woorule/tags/2.7.0/assets/woorule.js

    r2652963 r2680885  
    44        $('.woorule-subscribe .error').show();
    55    }
     6
     7    $('.woorule-subscribe__checkbox', '.woorule-subscribe').on('change', ({ target }) => {
     8        $('input[type="submit"]', '.woorule-subscribe form').prop('disabled', !target.checked)
     9    })
    610
    711    $('.woorule-subscribe form').submit(function (e) {
     
    1115        let email = $('.woorule-subscribe #semail').val();
    1216        let tags = $('.woorule-subscribe .tag').val();
     17        const requireOptIn = $('.woorule-subscribe [name="require-opt-in"]').val();
    1318
    1419        if ((!email) || (email.length < 4)) {
     
    2833                nonce: ajax_var.nonce,
    2934                email,
    30                 tags
     35                tags,
     36                requireOptIn
    3137            },
    3238            success(data) {
  • woorule/tags/2.7.0/inc/class-rulemailer-api.php

    r2665748 r2680885  
    3838            static::log( 'Error: ' . $resp->get_error_message() );
    3939        } else {
    40             static::log( 'Subscribe Success: ' . print_r( $resp['body'], true ) );
    41             static::log( 'Subscribe Success: ' . print_r( $body_data, true ) );
     40            $resp = json_decode( wp_remote_retrieve_body( $resp ), true );
     41            if ( isset( $resp['error'] ) ) {
     42                static::log( 'Error: ' . wc_print_r( $resp, true ) );
     43                static::log( 'Error: ' . wc_print_r( $body_data, true ) );
     44            } else {
     45                static::log( 'Subscribe Success: ' . wc_print_r( $resp, true ) );
     46                static::log( 'Subscribe Success: ' . wc_print_r( $body_data, true ) );
     47            }
    4248        }
    4349    }
     
    6369            static::log( 'Error delete subscriber tag: ' . $resp->get_error_message() );
    6470        } else {
    65             static::log( 'Subscriber tag deleted successfully: ' . print_r( $resp['body'], true ) );
     71            $resp = json_decode( wp_remote_retrieve_body( $resp ), true );
     72            if ( isset( $resp['error'] ) ) {
     73                static::log( 'Error: ' . wc_print_r( $resp, true ) );
     74                static::log( 'Error: ' . wc_print_r( compact( 'email', 'tag' ), true ) );
     75            } else {
     76                static::log( 'Subscriber tag deleted successfully: ' . wc_print_r( $resp, true ) );
     77            }
    6678        }
    6779    }
     
    7991
    8092            if ( is_array( $msg ) || is_object( $msg ) ) {
    81                 // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
    82                 $logger->add( 'woorule', print_r( $msg, true ) );
     93                $logger->add( 'woorule', wc_print_r( $msg, true ) );
    8394            } else {
    8495                $logger->add( 'woorule', $msg );
  • woorule/tags/2.7.0/inc/class-woorule-cart-hooks.php

    r2671567 r2680885  
    8383        if ( ! $this->retrieve_current_customer() ) {
    8484            return;
     85        }
     86
     87        $email = $this->current_customer->get_billing_email();
     88        if ( empty( $email ) ) {
     89            $email = $this->current_customer->get_email();
    8590        }
    8691
     
    98103            'tags'                => $this->get_subscription_tags(),
    99104            'subscribers'         => array(
    100                 'email'        => $this->current_customer->get_billing_email(),
     105                'email'        => $email,
    101106                'phone_number' => $this->current_customer->get_billing_phone(),
    102107                'language'     => substr( get_locale(), 0, 2 ),
  • woorule/tags/2.7.0/inc/class-woorule-order-hooks.php

    r2671567 r2680885  
    7171        RuleMailer_API::subscribe( $subscription );
    7272
    73         if ( $order->meta_exists( '_cart_in_progress_deleted' ) ) {
     73        if ( ! $order->meta_exists( '_cart_in_progress_deleted' ) ) {
    7474            RuleMailer_API::delete_subscriber_tag( $order->get_billing_email(), 'CartInProgress' );
    75             $order->add_meta_data( '_cart_in_progress_deleted', true );
     75            $order->add_meta_data( '_cart_in_progress_deleted', true, true );
    7676            $order->save();
    7777        }
  • woorule/tags/2.7.0/inc/class-woorule-shortcode.php

    r2671567 r2680885  
    7878                'error'       => __( 'Oops, something is wrong..', 'woorule' ),
    7979                'tag'         => '',
     80                'checkbox'    => '',
     81        'require_opt_in' => false,
    8082            ),
    8183            $atts,
     
    122124        }
    123125
     126        // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash
     127        $require_opt_in = filter_var( $_POST['requireOptIn'], FILTER_VALIDATE_BOOLEAN );
     128
    124129        $subscription = array(
    125130            'apikey'              => Woorule_Options::get_api_key(),
     
    132137                'email' => $email,
    133138            ),
     139            'require_opt_in'      => $require_opt_in,
    134140        );
    135141
  • woorule/tags/2.7.0/inc/partials/shortcode-woorule.php

    r2661379 r2680885  
    1515        <label for="semail" class="form_elem"><?php echo esc_html( $args['title'] ); ?></label>
    1616        <input type="text" id="semail" name="email" class="form_elem" placeholder="<?php echo esc_html( $args['placeholder'] ); ?>"/>
    17         <input type="submit" value="<?php echo esc_html( $args['submit'] ); ?>" class="form_elem"/>
     17        <input type="submit" value="<?php echo esc_html( $args['submit'] ); ?>" class="form_elem"
     18            <?php disabled( ! empty( $args['checkbox'] ) ); ?>
     19        />
    1820        <input type="hidden" value="<?php echo esc_html( $args['tag'] ); ?>" name="tags" class="tag"/>
     21        <input type="hidden" value="<?php echo esc_html( $args['require_opt_in'] ); ?>" name="require-opt-in"/>
    1922        <p class="hidden success"><?php echo esc_html( $args['success'] ); ?></p>
    2023        <p class="hidden error"><?php echo esc_html( $args['error'] ); ?></p>
     24
     25        <?php if ( $args['checkbox'] ) : ?>
     26            <label>
     27                <input type="checkbox" class="woorule-subscribe__checkbox">
     28                <?php echo wp_kses_post( $args['checkbox'] ); ?>
     29            </label>
     30        <?php endif; ?>
    2131    </form>
    2232</div>
  • woorule/tags/2.7.0/languages/woorule.pot

    r2671567 r2680885  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: WooRule 2.6.0\n"
     5"Project-Id-Version: WooRule 2.7.0\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woorule\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1212"POT-Creation-Date: 2022-02-02T11:13:33+03:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    14 "X-Generator: WP-CLI 2.6.0\n"
     14"X-Generator: WP-CLI 2.7.0\n"
    1515"X-Domain: woorule\n"
    1616
  • woorule/tags/2.7.0/woorule.php

    r2671567 r2680885  
    99 * Plugin URI:      http://github.com/rulecom/woorule
    1010 * Description:     Rule integration for WooCommerce
    11  * Version:         2.6.0
     11 * Version:         2.7.0
    1212 * Author:          Rule
    1313 * Author URI:      http://rule.se
     
    1919 */
    2020
    21 define( 'WOORULE_VERSION', '2.6.0' );
     21define( 'WOORULE_VERSION', '2.7.0' );
    2222define( 'WOORULE_PATH', plugin_dir_path( __FILE__ ) );
    2323define( 'WOORULE_URL', plugin_dir_url( __FILE__ ) );
  • woorule/trunk/README.txt

    r2671567 r2680885  
    33Tags: rule, woocommerce, newsletter, marketing
    44Requires at least: 5.0.0
    5 Tested up to: 5.8.3
     5Tested up to: 5.9
    66Requires PHP: 5.6+
    7 Stable tag: 2.6.0
     7Stable tag: 2.7.0
    88License: MIT
    99License URI: http://opensource.org/licenses/MIT
     
    4141You can embed a Newsletter sign-up form in your posts, or on any page with a simple shortcode `[woorule]`
    4242
    43 You can also customize the sign-up form with any of the following shortcode options:
     43You can also customize the sign-up form with any of the following shortcode attributes:
     44
    4445`
    45 [woorule title="Custom Title" placeholder="Custom Placeholder Text" button="Custom Button Text" success="Custom Success Message" tag="Custom Tag"]
     46[woorule title="Custom Title" placeholder="Custom Placeholder Text" button="Custom Button Text" checkbox="Custom Text Next To Checkbox" success="Custom Success Message" tag="Custom Tag" require_opt_in=false]
    4647`
    47 The `tag` field will be applied to the subscriber when the form is submitted. If no tag field is used a `Newsletter` tag will be applied by default.
     48
     49The `checkbox` attribute will add a checkbox below the signup form. If this attribute is present then checking the checkbox is required before the form can be submitted. This is useful for ensuring the subscriber agrees to your terms before being added to a mailing list.
     50
     51The `tag` attribute will be applied to the subscriber when the form is submitted. If no tag field is used a `Newsletter` tag will be applied by default.
     52
     53The `require_opt_in` attribute, if set to `true`, will require the subscriber to accept an opt-in email before further marketing emails can be sent. The opt-in flow requires you to have a [subscriber form](https://app.rule.io/#/subscriber/subscriber-form) setup in your Rule account in order for the opt-in email to be sent to the subscriber. Note that the `tag` attribute should be the same as the form tag.
     54
    4855
    4956== Frequently Asked Questions ==
     
    101108
    102109For more information, check out our [releases](https://github.com/rulecom/woorule/releases).
     110
     111= 2.7.0 =
     112* Added an optional `checkbox` attribute to the woorule shortcode, which must be checked before the form can be submitted
     113* Added an optional `require_opt_in` attribute to the woorule shortcode, which sends the subscriber an opt-in email before they can received additional marketing emails
     114* Fixed Cart In Progress bug
     115* Improved logging
    103116
    104117= 2.6.0 =
  • woorule/trunk/assets/woorule.js

    r2652963 r2680885  
    44        $('.woorule-subscribe .error').show();
    55    }
     6
     7    $('.woorule-subscribe__checkbox', '.woorule-subscribe').on('change', ({ target }) => {
     8        $('input[type="submit"]', '.woorule-subscribe form').prop('disabled', !target.checked)
     9    })
    610
    711    $('.woorule-subscribe form').submit(function (e) {
     
    1115        let email = $('.woorule-subscribe #semail').val();
    1216        let tags = $('.woorule-subscribe .tag').val();
     17        const requireOptIn = $('.woorule-subscribe [name="require-opt-in"]').val();
    1318
    1419        if ((!email) || (email.length < 4)) {
     
    2833                nonce: ajax_var.nonce,
    2934                email,
    30                 tags
     35                tags,
     36                requireOptIn
    3137            },
    3238            success(data) {
  • woorule/trunk/inc/class-rulemailer-api.php

    r2665748 r2680885  
    3838            static::log( 'Error: ' . $resp->get_error_message() );
    3939        } else {
    40             static::log( 'Subscribe Success: ' . print_r( $resp['body'], true ) );
    41             static::log( 'Subscribe Success: ' . print_r( $body_data, true ) );
     40            $resp = json_decode( wp_remote_retrieve_body( $resp ), true );
     41            if ( isset( $resp['error'] ) ) {
     42                static::log( 'Error: ' . wc_print_r( $resp, true ) );
     43                static::log( 'Error: ' . wc_print_r( $body_data, true ) );
     44            } else {
     45                static::log( 'Subscribe Success: ' . wc_print_r( $resp, true ) );
     46                static::log( 'Subscribe Success: ' . wc_print_r( $body_data, true ) );
     47            }
    4248        }
    4349    }
     
    6369            static::log( 'Error delete subscriber tag: ' . $resp->get_error_message() );
    6470        } else {
    65             static::log( 'Subscriber tag deleted successfully: ' . print_r( $resp['body'], true ) );
     71            $resp = json_decode( wp_remote_retrieve_body( $resp ), true );
     72            if ( isset( $resp['error'] ) ) {
     73                static::log( 'Error: ' . wc_print_r( $resp, true ) );
     74                static::log( 'Error: ' . wc_print_r( compact( 'email', 'tag' ), true ) );
     75            } else {
     76                static::log( 'Subscriber tag deleted successfully: ' . wc_print_r( $resp, true ) );
     77            }
    6678        }
    6779    }
     
    7991
    8092            if ( is_array( $msg ) || is_object( $msg ) ) {
    81                 // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
    82                 $logger->add( 'woorule', print_r( $msg, true ) );
     93                $logger->add( 'woorule', wc_print_r( $msg, true ) );
    8394            } else {
    8495                $logger->add( 'woorule', $msg );
  • woorule/trunk/inc/class-woorule-cart-hooks.php

    r2671567 r2680885  
    8383        if ( ! $this->retrieve_current_customer() ) {
    8484            return;
     85        }
     86
     87        $email = $this->current_customer->get_billing_email();
     88        if ( empty( $email ) ) {
     89            $email = $this->current_customer->get_email();
    8590        }
    8691
     
    98103            'tags'                => $this->get_subscription_tags(),
    99104            'subscribers'         => array(
    100                 'email'        => $this->current_customer->get_billing_email(),
     105                'email'        => $email,
    101106                'phone_number' => $this->current_customer->get_billing_phone(),
    102107                'language'     => substr( get_locale(), 0, 2 ),
  • woorule/trunk/inc/class-woorule-order-hooks.php

    r2671567 r2680885  
    7171        RuleMailer_API::subscribe( $subscription );
    7272
    73         if ( $order->meta_exists( '_cart_in_progress_deleted' ) ) {
     73        if ( ! $order->meta_exists( '_cart_in_progress_deleted' ) ) {
    7474            RuleMailer_API::delete_subscriber_tag( $order->get_billing_email(), 'CartInProgress' );
    75             $order->add_meta_data( '_cart_in_progress_deleted', true );
     75            $order->add_meta_data( '_cart_in_progress_deleted', true, true );
    7676            $order->save();
    7777        }
  • woorule/trunk/inc/class-woorule-shortcode.php

    r2671567 r2680885  
    7878                'error'       => __( 'Oops, something is wrong..', 'woorule' ),
    7979                'tag'         => '',
     80                'checkbox'    => '',
     81        'require_opt_in' => false,
    8082            ),
    8183            $atts,
     
    122124        }
    123125
     126        // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash
     127        $require_opt_in = filter_var( $_POST['requireOptIn'], FILTER_VALIDATE_BOOLEAN );
     128
    124129        $subscription = array(
    125130            'apikey'              => Woorule_Options::get_api_key(),
     
    132137                'email' => $email,
    133138            ),
     139            'require_opt_in'      => $require_opt_in,
    134140        );
    135141
  • woorule/trunk/inc/partials/shortcode-woorule.php

    r2661379 r2680885  
    1515        <label for="semail" class="form_elem"><?php echo esc_html( $args['title'] ); ?></label>
    1616        <input type="text" id="semail" name="email" class="form_elem" placeholder="<?php echo esc_html( $args['placeholder'] ); ?>"/>
    17         <input type="submit" value="<?php echo esc_html( $args['submit'] ); ?>" class="form_elem"/>
     17        <input type="submit" value="<?php echo esc_html( $args['submit'] ); ?>" class="form_elem"
     18            <?php disabled( ! empty( $args['checkbox'] ) ); ?>
     19        />
    1820        <input type="hidden" value="<?php echo esc_html( $args['tag'] ); ?>" name="tags" class="tag"/>
     21        <input type="hidden" value="<?php echo esc_html( $args['require_opt_in'] ); ?>" name="require-opt-in"/>
    1922        <p class="hidden success"><?php echo esc_html( $args['success'] ); ?></p>
    2023        <p class="hidden error"><?php echo esc_html( $args['error'] ); ?></p>
     24
     25        <?php if ( $args['checkbox'] ) : ?>
     26            <label>
     27                <input type="checkbox" class="woorule-subscribe__checkbox">
     28                <?php echo wp_kses_post( $args['checkbox'] ); ?>
     29            </label>
     30        <?php endif; ?>
    2131    </form>
    2232</div>
  • woorule/trunk/languages/woorule.pot

    r2671567 r2680885  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: WooRule 2.6.0\n"
     5"Project-Id-Version: WooRule 2.7.0\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woorule\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1212"POT-Creation-Date: 2022-02-02T11:13:33+03:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    14 "X-Generator: WP-CLI 2.6.0\n"
     14"X-Generator: WP-CLI 2.7.0\n"
    1515"X-Domain: woorule\n"
    1616
  • woorule/trunk/woorule.php

    r2671567 r2680885  
    99 * Plugin URI:      http://github.com/rulecom/woorule
    1010 * Description:     Rule integration for WooCommerce
    11  * Version:         2.6.0
     11 * Version:         2.7.0
    1212 * Author:          Rule
    1313 * Author URI:      http://rule.se
     
    1919 */
    2020
    21 define( 'WOORULE_VERSION', '2.6.0' );
     21define( 'WOORULE_VERSION', '2.7.0' );
    2222define( 'WOORULE_PATH', plugin_dir_path( __FILE__ ) );
    2323define( 'WOORULE_URL', plugin_dir_url( __FILE__ ) );
Note: See TracChangeset for help on using the changeset viewer.