Plugin Directory

Changeset 2354434


Ignore:
Timestamp:
08/07/2020 08:36:34 AM (6 years ago)
Author:
rulecom
Message:

1.2 release

Location:
woorule/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • woorule/trunk/README.md

    r2338430 r2354434  
    7272Bugfixes
    7373Visual Adjustments
     74
     75### 1.2
     76Bugfixes
  • woorule/trunk/README.txt

    r2338430 r2354434  
    6060Bugfixes
    6161Visual Adjustments
     62
     63= 1.2 =
     64Bugfixes
  • woorule/trunk/includes/admin/settings/class-wc-admin-settings-woorule.php

    r2338430 r2354434  
    8484            if ($enabled) {
    8585                $which_event    = get_option($rule['occurs']['id']);
    86                 $is_opt_in_rule = false;
    87                 $want_in        = true;
     86                $optInCheckboxIsShown = false;
     87                $acceptsOptIn        = false;
    8888
    8989                if (isset($rule['show_opt_in'])) {
    90                     $is_opt_in_rule = get_option($rule['show_opt_in']['id']) === 'yes' ? true : false;
     90                    $optInCheckboxIsShown = get_option($rule['show_opt_in']['id']) === 'yes' ? true : false;
    9191                }
    9292
    93                 if ($is_opt_in_rule) {
    94                     $want_in = get_post_meta($id, 'woorule_opt_in_'.$k, false);
    95 
    96                     if (! empty($want_in)) {
    97                         $want_in = $want_in[0] === 'yes' ? true : false;
     93                if ($optInCheckboxIsShown) {
     94                    $acceptsOptIn = get_post_meta($id, 'woorule_opt_in_'.$k, false);
     95
     96                    if (! empty($acceptsOptIn)) {
     97                        $acceptsOptIn = $acceptsOptIn[0] === 'yes' ? true : false;
    9898                    }
    9999                }
    100100
    101                 if ($want_in && $new_status === $which_event) {
     101                if ($new_status === $which_event) {
    102102                    $integration    = new WC_Integration_RuleMailer();
    103103                    $order          = new WC_Order($id);
     
    149149                    $phone = $order->get_billing_phone();
    150150
    151                     $newphone = '';
    152                     if ((preg_match('/\+(0|\+?\d{2})(\d{7,8})/', $phone))) {
    153                         $newphone = array('key' =>'Subscriber.Tele', 'value' =>  $phone);
    154                     }
    155 
    156151                    // I feel bad for this, but no other methods was working.
    157152                    $newtags = explode(',', get_option($rule['tags']['id']));
    158153                    if (!(strlen($newtags[0])>1)) {
    159154                        $newtags[0]='OrderComplete';
     155                    }
     156
     157                    if ($acceptsOptIn) {
     158                        array_push($newtags, 'Newsletter');
    160159                    }
    161160
     
    167166                        'auto_create_tags'      => get_option($rule['auto_create_tags']['id'])      === 'yes' ? true : false,
    168167                        'auto_create_fields'    => get_option($rule['auto_create_fields']['id'])    === 'yes' ? true : false,
    169                         'automation'    => get_option($rule['automation']['id'])    === 'reset' ? 'reset' : 'force',
     168                        'automation'    => get_option($rule['automation']['id']),
    170169
    171170                        'async'  => true,
     
    221220                                    'key'           => 'Subscriber.Company',
    222221                                    'value'     => $order->get_billing_company()
    223                                 ),               
     222                                ),
     223                                array(
     224                                    'key'           => 'Subscriber.Source',
     225                                    'value'     => 'WooRule'
     226                                ),                   
    224227                                array(
    225228                                    'key'           => 'Order.Date',
     
    516519                'default'       => 'reset',
    517520                'options'   => array(
     521                    'default'       => __('Default', 'woorule'),
    518522                    'force'     => __('Force', 'woorule'),
    519                     'reset' => __('Reset', 'woorule')
     523                    'reset' => __('Reset', 'woorule'),
    520524                ),
    521525            ),
  • woorule/trunk/includes/api/class-wc-rulemailer-api.php

    r2099597 r2354434  
    2929    public static function new_subscription($email)
    3030    {
     31        $sourceData = array(
     32            'key' => 'Subscriber.Source',
     33            'value' => 'WooRule'
     34        );
     35
    3136        $subscription = array(
    3237            'apikey'              => get_option('woocommerce_rulemailer_settings')['woorule_api_key'],
     
    3641            'async'  => true,
    3742            'tags'  => array('Newsletter'),
    38             'subscribers' => array('email' => $email)
     43            'subscribers' => array('email' => $email, 'fields' => array($sourceData))
    3944        );
    4045
     
    7277            if (is_array($msg) || is_object($msg)) {
    7378                $logger->add('woorule', print_r($msg, true));
    74             //$logger->add('woorule', print_r( json_encode($body_data), true ) );
    7579            } else {
    7680                $logger->add('woorule', $msg);
    77                 //$logger->add('woorule', json_encode($body_data) );
    7881            }
    7982        }
  • woorule/trunk/includes/class-wc-woorule.php

    r2338430 r2354434  
    7878                'default'       => 'reset',
    7979                'options'   => array(
     80                    'default'       => __('Default', 'woorule'),
    8081                    'force'     => __('Force', 'woorule'),
    8182                    'reset' => __('Reset', 'woorule')
  • woorule/trunk/woorule.php

    r2338430 r2354434  
    99 * Plugin URI:      http://github.com/rulecom/woorule
    1010 * Description:     RuleMailer integration for WooCommerce.
    11  * Version:         1.1
     11 * Version:         1.2
    1212 * Author:          RuleMailer, Neevalex
    1313 * Author URI:      http://rule.se
Note: See TracChangeset for help on using the changeset viewer.