Plugin Directory

Changeset 3002249


Ignore:
Timestamp:
11/27/2023 03:28:25 PM (2 years ago)
Author:
eberwp
Message:

update version 3.3

Location:
eber/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • eber/trunk/index.php

    r2973272 r3002249  
    55Description: Eber is a smart member system comes with comprehensive loyalty & rewards system, marketing and analytic tool.
    66Author: Eber
    7 Version: 3.2
     7Version: 3.3
    88Author URI: https://eber.co
    99License: GPLv2 or later
  • eber/trunk/init/eber_woo.php

    r2973272 r3002249  
    5656             else
    5757             {
    58                     if($order->get_status() == 'completed')
     58                $adjust_point = get_option('adjust_point_when','order_completed');
     59                    if(($adjust_point == 'order_completed' && $order->get_status() == 'completed') || ($adjust_point == 'after_payment' && $order->get_status() == get_option('issue_point_when','processing')))
    5960                    {
    6061                            $result = $api->setData($post_data)
     
    218219             else
    219220             {
    220                 $result = $api->setData($post_data)
    221                      ->setQueue()
    222                      ->requireAuth($api_key)
    223                      ->post('/v5/point/ecom');
    224                  
    225                      if (!$result->isFailure())
    226                      {
    227                          $return_api = $result->data;
    228                          $time = current_time('mysql');
    229    
    230                          $data = array(
    231                              'comment_post_ID' => $order_id,
    232                              'comment_author' => $user->user_login,
    233                              'comment_author_email' => $user->user_email,
    234                              'comment_author_url' => '',
    235                              'comment_content' => 'Eber Success : Added '.$return_api['points'].' Points',
    236                              'comment_type' => 'order_note',
    237                              'comment_parent' => 0,
    238                              'user_id' => $user->ID,
    239                              'comment_author_IP' => '',
    240                              'comment_agent' => 'Eber',
    241                              'comment_date' => $time,
    242                              'comment_approved' => 1,
    243                          );
    244                          wp_insert_comment($data);
    245                      }
    246                      else
    247                      {
    248      
    249                          $time = current_time('mysql');
    250                          $data = array(
    251                              'comment_post_ID' => $order_id,
    252                              'comment_author' => $user->user_login,
    253                              'comment_author_email' => $user->user_email,
    254                              'comment_author_url' => '',
    255                              'comment_content' => 'Eber Error : '.$result->getErrorString(),
    256                              'comment_type' => 'order_note',
    257                              'comment_parent' => 0,
    258                              'user_id' => $user->ID,
    259                              'comment_author_IP' => '',
    260                              'comment_agent' => 'Eber',
    261                              'comment_date' => $time,
    262                              'comment_approved' => 1,
    263                          );
    264                          wp_insert_comment($data);
    265                      }
     221                $adjust_point = get_option('adjust_point_when','order_completed');
     222                if(($adjust_point == 'after_payment' && $order->get_status() == get_option('issue_point_when','processing')))
     223                {
     224                    $result = $api->setData($post_data)
     225                        ->setQueue()
     226                        ->requireAuth($api_key)
     227                        ->post('/v5/point/ecom');
     228                   
     229                        if (!$result->isFailure())
     230                        {
     231                            $return_api = $result->data;
     232                            $time = current_time('mysql');
     233       
     234                            $data = array(
     235                                'comment_post_ID' => $order_id,
     236                                'comment_author' => $user->user_login,
     237                                'comment_author_email' => $user->user_email,
     238                                'comment_author_url' => '',
     239                                'comment_content' => 'Eber Success : Added '.$return_api['points'].' Points',
     240                                'comment_type' => 'order_note',
     241                                'comment_parent' => 0,
     242                                'user_id' => $user->ID,
     243                                'comment_author_IP' => '',
     244                                'comment_agent' => 'Eber',
     245                                'comment_date' => $time,
     246                                'comment_approved' => 1,
     247                            );
     248                            wp_insert_comment($data);
     249                        }
     250                        else
     251                        {
     252       
     253                            $time = current_time('mysql');
     254                            $data = array(
     255                                'comment_post_ID' => $order_id,
     256                                'comment_author' => $user->user_login,
     257                                'comment_author_email' => $user->user_email,
     258                                'comment_author_url' => '',
     259                                'comment_content' => 'Eber Error : '.$result->getErrorString(),
     260                                'comment_type' => 'order_note',
     261                                'comment_parent' => 0,
     262                                'user_id' => $user->ID,
     263                                'comment_author_IP' => '',
     264                                'comment_agent' => 'Eber',
     265                                'comment_date' => $time,
     266                                'comment_approved' => 1,
     267                            );
     268                            wp_insert_comment($data);
     269                        }
     270                }
    266271             }
    267272           
  • eber/trunk/init/menu.php

    r2855283 r3002249  
    2525            $eber_custom_signup_url = get_option('eber_custom_signup_url','');
    2626            $adjust_point_when = get_option('adjust_point_when','order_completed');
     27            $issue_point_when  = get_option('issue_point_when','processing');
    2728            $eber_welcome_email = get_option('eber_welcome_email',false);
    2829            $exclude_tax = get_option('exclude_tax',true);
     
    4142                $eber_custom_link = (isset($_POST['eber_custom_link']));
    4243                $eber_welcome_email = (isset($_POST['eber_welcome_email']));
    43 
     44               
    4445                $exclude_tax = (isset($_POST['exclude_tax']));
    4546                $exclude_shipping = (isset($_POST['exclude_shipping']));
     
    174175                                {
    175176                                    update_option('exclude_shipping',false);
     177                                }
     178                                if(isset($_POST['issue_point_when']))
     179                                {
     180                                    update_option('issue_point_when',sanitize_text_field($_POST['issue_point_when']));
     181                                    $issue_point_when = sanitize_text_field($_POST['issue_point_when']);
    176182                                }
    177183
  • eber/trunk/layout/index.php

    r2328520 r3002249  
    11<?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
     2$order_statuses = array(
     3    'pending'    => _x( 'Pending payment', 'Order status', 'woocommerce' ),
     4    'processing' => _x( 'Processing', 'Order status', 'woocommerce' ),
     5    'on-hold'    => _x( 'On hold', 'Order status', 'woocommerce' ),
     6    'completed'  => _x( 'Completed', 'Order status', 'woocommerce' ),
     7    'cancelled'  => _x( 'Cancelled', 'Order status', 'woocommerce' ),
     8    'refunded'   => _x( 'Refunded', 'Order status', 'woocommerce' ),
     9    'failed'     => _x( 'Failed', 'Order status', 'woocommerce' ),
     10);
    211?>
    312<div class="wrap">
     
    3039{ ?>
    3140    <tr>
    32         <th scope="row"><label for="adjust_point">Adjust Point When </label></th>
     41        <th scope="row"><label for="adjust_point">Issue Point When </label></th>
    3342        <td><select name="adjust_point_when" >
    3443                <option value="order_completed" <?php echo ($adjust_point_when == 'order_completed')?'selected':''; ?>>Order Completed</option>
     
    3645            </select>
    3746        </td>
     47    </tr>
     48    <tr>
     49    <tr id="tr_issue_point_when">
     50        <th scope="row"><label for="issue_point">Status to Issue point </label></th>
     51        <td><select name="issue_point_when" >
     52               <?php
     53               foreach($order_statuses as $key=>$status)
     54               {?>
     55              <option value="<?php echo $key;?>" <?php echo ($issue_point_when == $key)?'selected':''; ?> ><?php echo $status ;?></option>
     56               <?php }
     57               ?>
     58            </select>
     59        </td>
     60    </tr>
    3861    </tr>
    3962<?php }
     
    157180</form>
    158181<script type="text/javascript">
     182    function changeAdjustPoint()
     183    {
     184        if(jQuery("select[name='adjust_point_when']").val() == 'after_payment')
     185        {
     186            jQuery("#tr_issue_point_when").show();
     187        }
     188        else
     189        {
     190            jQuery("#tr_issue_point_when").hide();
     191        }
     192    }
    159193    jQuery(document).ready(function(){
     194        changeAdjustPoint();
     195        jQuery("select[name='adjust_point_when']").on('change',function(){
     196            changeAdjustPoint();
     197        });
    160198       jQuery("input[name='eber_custom_link']").click(function(){
    161199          if(jQuery("input[name='eber_custom_link']").is(':checked'))
     
    169207       });
    170208    });
     209   
    171210</script>
  • eber/trunk/readme.txt

    r2973272 r3002249  
    9090= 3.2 =
    9191update fix problem with Woo payment
     92= 3.3 =
     93update settings to change status for after payment
    9294
    9395
Note: See TracChangeset for help on using the changeset viewer.