Plugin Directory

Changeset 2376039


Ignore:
Timestamp:
09/06/2020 12:18:48 PM (5 years ago)
Author:
burfbari
Message:

version 2 with changes on settings page and new customer related notification features

Location:
tg-sms-notify
Files:
2 added
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • tg-sms-notify/trunk/includes/notifycore.php

    r2358686 r2376039  
    8888        $sms_fire_on_price_change = (checked( 1, $options['smsPriceChange'], false )) ? 1 : 0;
    8989        $sms_fire_on_qty_below_threshold = (checked( 1, $options['smsQtyAlert'], false )) ? 1 : 0;
     90
     91        $sms_fire_on_order_processing = (checked( 1, $options['smsonOrderProcessing'], false )) ? 1 : 0;
     92        $sms_fire_on_order_completed = (checked( 1, $options['smsonOrderCompleted'], false )) ? 1 : 0;
    9093       
    91         return array( $sms_admin_flag, $message_text, $sms_fire_on_product_add, $sms_fire_on_price_change, $sms_fire_on_qty_below_threshold );
     94        return array( $sms_admin_flag, $message_text, $sms_fire_on_product_add, $sms_fire_on_price_change, $sms_fire_on_qty_below_threshold, $sms_fire_on_order_processing, $sms_fire_on_order_completed );
    9295    }
    9396
     
    99102
    100103        if ( ( $old_status == $new_status ) || ( $mail_flag_db[0] == 0 ) || (sanitize_text_field( $options['manager_number'] ) == '' ) ) {
    101             error_log('New Post Published Notification disabled or Manager Number missing');
     104            error_log('New Post Published Notification disabled or this is not a new post or Manager Number missing');
    102105            return;
    103106        }
     
    137140            return $post;
    138141        }
    139     }
    140 ?>
     142    }?>
  • tg-sms-notify/trunk/includes/notifywoocommerce.php

    r2368565 r2376039  
    44
    55    add_action( 'woocommerce_reduce_order_stock', 'tgsmsnotify_notifyQtyAlert' );
    6 
     6   
    77    function tgsmsnotify_notifyQtyAlert( $order ) { // you get an object $order as an argument
    88        $mail_flag_db = tgsmsnotify_fetch_sms_settings_from_db();
     
    1919
    2020        $items = $order->get_items();
    21 
     21       
    2222        foreach( $items as $item ) {
    2323            $product = wc_get_product( $item['product_id'] );
    2424
    25             if ($product->get_stock_quantity() <= $qtyThreshold)
     25            if ($product->get_stock_quantity() <= $qtyThreshold) 
    2626                $message .= $product->get_name() . ' ';
    2727        }
     
    6363            tgsmsnotify_send_twilio_sms ( $nickname, $notify_message_text );
    6464            tgsmsnotify_new_product('new');
    65 
     65           
    6666        } else {
    6767
     
    7777                $old_regular_price = $product->get_regular_price();
    7878                $old_sale_price = $product->get_sale_price();
    79 
     79   
    8080                error_log("Regular -------> $old_regular_price");
    8181                error_log("Sale -------> $old_sale_price");
     
    8383
    8484            if ( isset ($_POST["_regular_price"]) && isset ($_POST["_regular_price"]) ) {
    85                 $new_regular_price = intval ( $_POST["_regular_price"] );
    86                 $new_sale_price = intval ( $_POST["_sale_price"] );
     85                $new_regular_price = floatval ( $_POST["_regular_price"] );
     86                $new_sale_price = floatval ( $_POST["_sale_price"] );
    8787                error_log("POST Regular -------> $new_regular_price");
    8888                error_log("POST Sale -------> $new_sale_price");
     
    100100                    //mail("[email protected]", "New post published", $message_text);
    101101                    tgsmsnotify_send_twilio_sms ( $nickname, $message_text );
    102                 }
     102                }               
    103103            }
    104104        }
    105 
     105       
    106106        return $post;
    107     }
    108 
    109 ?>
     107    }?>
  • tg-sms-notify/trunk/includes/settings.php

    r2358686 r2376039  
    1515    }
    1616
    17     // section for Twilio account setting
    18 
    19     add_action( 'admin_init', 'tgsmsnotify_twilio_settings_init' );
    20    
    21     function tgsmsnotify_twilio_settings_init() {
    22        
    23         add_settings_section(
    24             'tgsmsnotify_twilio_setting_section',
    25             'Your Twilio account settings',
    26             'tgsmsnotify_twilio_setting_section_callback_function',
    27             'tgsmsnotify_settings_page'
    28         );
    29 
    30         add_settings_field(
    31             'tgsmsnotify_twilio_account_sid_field',
    32             'Twilio Account SId',
    33             'tgsmsnotify_twilio_account_sid_field_callback',
    34             'tgsmsnotify_settings_page',
    35             'tgsmsnotify_twilio_setting_section'
    36         );
    37 
    38         add_settings_field(
    39             'tgsmsnotify_twilio_account_auth_token_field',
    40             'Twilio Auth Token',
    41             'tgsmsnotify_twilio_account_auth_token_field_callback',
    42             'tgsmsnotify_settings_page',
    43             'tgsmsnotify_twilio_setting_section'
    44         );
    45 
    46         add_settings_field(
    47             'tgsmsnotify_twilio_account_from_number_field',
    48             'Twilio From number (without +)',
    49             'tgsmsnotify_twilio_account_from_number_field_callback',
    50             'tgsmsnotify_settings_page',
    51             'tgsmsnotify_twilio_setting_section'
    52         );
    53 
    54         register_setting( 'tgsmsnotify_settings_page', 'tgsmsnotify_twilio_setting_section', 'tgsmsnotify_sanitize' );
    55 
     17
     18/*     public function display_options() {
     19        $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'general';
     20        if ( $active_tab == 'general' ) {
     21            //PC::debug(  'general', 'tab name:' );
     22            register_setting( 'general_section', 'eswc_settingz', array( $this, 'sanitize_general' ) );
     23            // ID / title / cb / page       
     24            $this->add_settings_section( 'general_section', null, array( $this, 'general_section_cb' ), $this->settings_page_name );
     25            // ID / title / cb / page / section /args
     26            add_settings_field( 'eswc_kill_gutenberg', __( 'Gutenberg', 'extra-settings-for-woocommerce' ), array( $this, 'eswc_kill_gutenberg_cb' ), $this->settings_page_name, 'general_section' );
     27            add_settings_field( 'eswc_change_email_author', __( 'WP core email author', 'extra-settings-for-woocommerce' ), array( $this, 'eswc_change_email_author_cb' ), $this->settings_page_name, 'general_section' );
     28        } else if ( $active_tab == 'account' ) {
     29            //PC::debug(  'account', 'tab name:' );
     30            register_setting( 'account_section', 'eswc_settingz', array( $this, 'sanitize_account' ) );
     31            $this->add_settings_section( 'account_section', null, array( $this, 'account_section_cb' ), $this->settings_page_name );
     32            add_settings_field( 'eswc_redirect', __( 'Login redirect', 'extra-settings-for-woocommerce' ), array( $this, 'eswc_redirect_cb' ), $this->settings_page_name, 'account_section' );     
     33        }
     34    } */
     35
     36
     37    add_action( 'admin_init', 'tgsmsnotify_settings_init' );
     38   
     39    function tgsmsnotify_settings_init () {
     40       
     41        $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'sms-sender-settings';
     42        //error_log($active_tab);
     43
     44        // tab for SMS Sender (Twilio) account setting
     45
     46        if ( $active_tab == 'sms-sender-settings' ) {
     47
     48            add_settings_section(
     49                'tgsmsnotify_twilio_setting_section',
     50                '',
     51                'tgsmsnotify_twilio_setting_section_callback_function',
     52                'tgsmsnotify_twilio_settings_page'
     53            );
     54
     55            add_settings_field(
     56                'tgsmsnotify_twilio_account_sid_field',
     57                'Twilio Account SId',
     58                'tgsmsnotify_twilio_account_sid_field_callback',
     59                'tgsmsnotify_twilio_settings_page',
     60                'tgsmsnotify_twilio_setting_section'
     61            );
     62
     63            add_settings_field(
     64                'tgsmsnotify_twilio_account_auth_token_field',
     65                'Twilio Auth Token',
     66                'tgsmsnotify_twilio_account_auth_token_field_callback',
     67                'tgsmsnotify_twilio_settings_page',
     68                'tgsmsnotify_twilio_setting_section'
     69            );
     70
     71            add_settings_field(
     72                'tgsmsnotify_twilio_account_from_number_field',
     73                'Twilio From number (without +)',
     74                'tgsmsnotify_twilio_account_from_number_field_callback',
     75                'tgsmsnotify_twilio_settings_page',
     76                'tgsmsnotify_twilio_setting_section'
     77            );
     78
     79            add_settings_field(
     80                'tgsmsnotify_deletePluginData_field',
     81                'Delete Plugin Data on Uninstall',
     82                'tgsmsnotify_deletePluginData_field_callback',
     83                'tgsmsnotify_twilio_settings_page',
     84                'tgsmsnotify_twilio_setting_section'
     85            );
     86   
     87            register_setting( 'tgsmsnotify_twilio_setting_section', 'tgsmsnotify_setting_section', 'tgsmsnotify_sanitize_twilio' );
     88
     89        // tab for setting Manager Notifications
     90        } else if ( $active_tab == 'manager-options' ) {
     91
     92            add_settings_section(
     93                'tgsmsnotify_setting_section',
     94                '',
     95                'tgsmsnotify_setting_section_callback_function',
     96                'tgsmsnotify_manager_settings_page'
     97            );
     98
     99            add_settings_field(
     100                'tgsmsnotify_sendSMS_managerNumber_field',
     101                'Recipient Manager Number (without +)',
     102                'tgsmsnotify_sendSMS_managerNumber_field_callback',
     103                'tgsmsnotify_manager_settings_page',
     104                'tgsmsnotify_setting_section'
     105            );
     106
     107            add_settings_field(
     108                'tgsmsnotify_sendSMS_field',
     109                'Send SMS for New Post',
     110                'tgsmsnotify_sendSMS_callback',
     111                'tgsmsnotify_manager_settings_page',
     112                'tgsmsnotify_setting_section'
     113            );
     114
     115            add_settings_field(
     116                'tgsmsnotify_sendSMS_messageTemplate_field',
     117                'Custom message for New Post',
     118                'tgsmsnotify_sendSMS_messageTemplate_callback',
     119                'tgsmsnotify_manager_settings_page',
     120                'tgsmsnotify_setting_section'
     121            );
     122
     123            add_settings_field(
     124                'tgsmsnotify_sendSMS_newProduct_field',
     125                'Send SMS for New Product',
     126                'tgsmsnotify_sendSMS_newProduct_callback',
     127                'tgsmsnotify_manager_settings_page',
     128                'tgsmsnotify_setting_section'
     129            );
     130
     131            add_settings_field(
     132                'tgsmsnotify_sendSMS_newProductMessage_field',
     133                'Custom message for New Product',
     134                'tgsmsnotify_sendSMS_newProductMessage_callback',
     135                'tgsmsnotify_manager_settings_page',
     136                'tgsmsnotify_setting_section'
     137            );
     138
     139            add_settings_field(
     140                'tgsmsnotify_sendSMS_priceChange_field',
     141                'Send SMS for Product Price Change',
     142                'tgsmsnotify_sendSMS_priceChange_callback',
     143                'tgsmsnotify_manager_settings_page',
     144                'tgsmsnotify_setting_section'
     145            );
     146
     147            add_settings_field(
     148                'tgsmsnotify_sendSMS_priceChangeMessage_field',
     149                'Custom message for Price Change',
     150                'tgsmsnotify_sendSMS_priceChangeMessage_callback',
     151                'tgsmsnotify_manager_settings_page',
     152                'tgsmsnotify_setting_section'
     153            );
     154
     155            add_settings_field(
     156                'tgsmsnotify_sendSMS_qtyAlert_field',
     157                'Send SMS for Quantity Alert',
     158                'tgsmsnotify_sendSMS_qtyAlert_callback',
     159                'tgsmsnotify_manager_settings_page',
     160                'tgsmsnotify_setting_section'
     161            );
     162
     163            add_settings_field(
     164                'tgsmsnotify_sendSMS_qtyThreshold_field',
     165                'Define Quantity Threshold',
     166                'tgsmsnotify_sendSMS_qtyThreshold_callback',
     167                'tgsmsnotify_manager_settings_page',
     168                'tgsmsnotify_setting_section'
     169            );
     170
     171            register_setting( 'tgsmsnotify_setting_section', 'tgsmsnotify_setting_section', 'tgsmsnotify_sanitize_manager' );
     172
     173        } else if ( $active_tab == 'customer-options' ) {
     174        // tab for setting Customer Notifications
     175
     176            add_settings_section(
     177                'tgsmsnotify_customer_setting_section',
     178                '',
     179                'tgsmsnotify_customer_setting_section_callback_function',
     180                'tgsmsnotify_customer_settings_page'
     181            );
     182       
     183            add_settings_field(
     184                'tgsmsnotify_sendSMS_onOrderProcessing_field',
     185                'Send SMS on Order Processing stage',
     186                'tgsmsnotify_sendSMS_onOrderProcessing_callback',
     187                'tgsmsnotify_customer_settings_page',
     188                'tgsmsnotify_customer_setting_section'
     189            );
     190
     191            add_settings_field(
     192                'tgsmsnotify_sendSMS_onOrderProcessing_Message_field',
     193                'Custom message for Order Processing stage',
     194                'tgsmsnotify_sendSMS_onOrderProcessing_Message_field_callback',
     195                'tgsmsnotify_customer_settings_page',
     196                'tgsmsnotify_customer_setting_section'
     197            );
     198
     199            add_settings_field(
     200                'tgsmsnotify_sendSMS_onOrderCompleted_field',
     201                'Send SMS on Order Completion',
     202                'tgsmsnotify_sendSMS_onOrderCompleted_callback',
     203                'tgsmsnotify_customer_settings_page',
     204                'tgsmsnotify_customer_setting_section'
     205            );
     206
     207            add_settings_field(
     208                'tgsmsnotify_sendSMS_onOrderCompleted_Message_field',
     209                'Custom message for Order Completion',
     210                'tgsmsnotify_sendSMS_onOrderCompleted_Message_field_callback',
     211                'tgsmsnotify_customer_settings_page',
     212                'tgsmsnotify_customer_setting_section'
     213            );
     214
     215            register_setting( 'tgsmsnotify_customer_setting_section', 'tgsmsnotify_setting_section', 'tgsmsnotify_sanitize_customer' );
     216        }
    56217    }
    57218   
    58219    function tgsmsnotify_twilio_setting_section_callback_function() {
    59220
    60         $twilio_flag_db = tgsmsnotify_get_twilio_details_from_db();
    61 
    62         if ( ( $twilio_flag_db[0] == '') || ($twilio_flag_db[1] == '') || ($twilio_flag_db[2] == '') ) {
    63             $html = '<p color="red">Twilio settings not available, SMS would not be triggered.</p>';
    64             echo $html ;
    65         } else {
    66             $html = '<p style="color:red;">Twilio settings available but not shown here, enter new settings and hit Save to overwrite the old ones.</p>';
    67             echo $html ;
     221        if ( !isset ( $_GET["tab"] ) || ( $_GET["tab"] == "sms-sender-settings" ) )
     222        {
     223            $twilio_flag_db = tgsmsnotify_get_twilio_details_from_db();
     224
     225            if ( ( $twilio_flag_db[0] == '') || ($twilio_flag_db[1] == '') || ($twilio_flag_db[2] == '') ) {
     226                $html = '<p color="red">Twilio settings not available, SMS would not be triggered.</p>';
     227                echo $html ;
     228            } else {
     229                $html = '<p style="color:red;">Twilio settings available but not shown here, enter new settings and hit Save to overwrite the old ones.</p>';
     230                echo $html ;
     231            }
    68232        }
    69233    }
     
    95259            $html .= '<br><p><i>With country code prefixed</i></p>';
    96260        }
    97 
    98         echo $html ;
    99     }
    100 
    101     // section for setting Post Publishing Notifications
    102    
    103     add_action( 'admin_init', 'tgsmsnotify_settings_init' );
    104    
    105     function tgsmsnotify_settings_init() {
    106        
    107         add_settings_section(
    108             'tgsmsnotify_setting_section',
    109             'TG SMS Notify settings',
    110             'tgsmsnotify_setting_section_callback_function',
    111             'tgsmsnotify_settings_page'
    112         );
    113 
    114         add_settings_field(
    115             'tgsmsnotify_sendSMS_managerNumber_field',
    116             'Recipient Manager Number (without +)',
    117             'tgsmsnotify_sendSMS_managerNumber_field_callback',
    118             'tgsmsnotify_settings_page',
    119             'tgsmsnotify_setting_section'
    120         );
    121 
    122         add_settings_field(
    123             'tgsmsnotify_sendSMS_field',
    124             'Send SMS for New Post',
    125             'tgsmsnotify_sendSMS_callback',
    126             'tgsmsnotify_settings_page',
    127             'tgsmsnotify_setting_section'
    128         );
    129 
    130         add_settings_field(
    131             'tgsmsnotify_sendSMS_messageTemplate_field',
    132             'Define message to be sent',
    133             'tgsmsnotify_sendSMS_messageTemplate_callback',
    134             'tgsmsnotify_settings_page',
    135             'tgsmsnotify_setting_section'
    136         );
    137 
    138         add_settings_field(
    139             'tgsmsnotify_sendSMS_newProduct_field',
    140             'Send SMS for New Product',
    141             'tgsmsnotify_sendSMS_newProduct_callback',
    142             'tgsmsnotify_settings_page',
    143             'tgsmsnotify_setting_section'
    144         );
    145 
    146         add_settings_field(
    147             'tgsmsnotify_sendSMS_newProductMessage_field',
    148             'Custom message for New Product',
    149             'tgsmsnotify_sendSMS_newProductMessage_callback',
    150             'tgsmsnotify_settings_page',
    151             'tgsmsnotify_setting_section'
    152         );
    153 
    154         add_settings_field(
    155             'tgsmsnotify_sendSMS_priceChange_field',
    156             'Send SMS for Product Price Change',
    157             'tgsmsnotify_sendSMS_priceChange_callback',
    158             'tgsmsnotify_settings_page',
    159             'tgsmsnotify_setting_section'
    160         );
    161 
    162         add_settings_field(
    163             'tgsmsnotify_sendSMS_priceChangeMessage_field',
    164             'Custom message for Price Change',
    165             'tgsmsnotify_sendSMS_priceChangeMessage_callback',
    166             'tgsmsnotify_settings_page',
    167             'tgsmsnotify_setting_section'
    168         );
    169 
    170         add_settings_field(
    171             'tgsmsnotify_sendSMS_qtyAlert_field',
    172             'Send SMS for Quantity Alert',
    173             'tgsmsnotify_sendSMS_qtyAlert_callback',
    174             'tgsmsnotify_settings_page',
    175             'tgsmsnotify_setting_section'
    176         );
    177 
    178         add_settings_field(
    179             'tgsmsnotify_sendSMS_qtyThreshold_field',
    180             'Define Quantity Threshold',
    181             'tgsmsnotify_sendSMS_qtyThreshold_callback',
    182             'tgsmsnotify_settings_page',
    183             'tgsmsnotify_setting_section'
    184         );
    185        
    186         add_settings_field(
    187             'tgsmsnotify_deletePluginData_field',
    188             'Delete Plugin Data on Uninstall',
    189             'tgsmsnotify_deletePluginData_field_callback',
    190             'tgsmsnotify_settings_page',
    191             'tgsmsnotify_setting_section'
    192         );
    193 
    194         register_setting( 'tgsmsnotify_settings_page', 'tgsmsnotify_setting_section', 'tgsmsnotify_sanitize' );
    195 
    196     }
    197 
    198     function tgsmsnotify_setting_section_callback_function() {
    199         require_once('notifycore.php');
    200 
    201         $html = '<p>Configure your Notification Manager Settings here</p><br />';
    202         echo $html ;
    203 
    204     }
    205 
    206     function tgsmsnotify_sendSMS_managerNumber_field_callback() {
    207         $options = get_option( 'tgsmsnotify_setting_section' );
    208 
    209         if ( isset ( $options['manager_number'] ) ) {
    210             $html = '<input type="text" id="tgsmsnotify_sendSMS_managerNumber_field" name="tgsmsnotify_setting_section[manager_number]" value="' . intval ($options['manager_number']) . '" />';
    211             $html .= '<br><p><i>With country code prefixed</i></p>';
    212         } else {
    213             $html = '<input type="text" id="tgsmsnotify_sendSMS_managerNumber_field" name="tgsmsnotify_setting_section[manager_number]" />';
    214             $html .= '<br><p><i>With country code prefixed</i></p>';
    215         }
    216         echo $html ;
    217     }
    218 
    219     function tgsmsnotify_sendSMS_messageTemplate_callback() {
    220         $options = get_option( 'tgsmsnotify_setting_section' );
    221 
    222         if ( isset ( $options['smsMessage'] ) )
    223             $html = '<textarea rows="4" cols="40" id="tgsmsnotify_sendSMS_messageTemplate_field" name="tgsmsnotify_setting_section[smsMessage]">' . esc_textarea( $options['smsMessage'] ) . '</textarea>';
    224         else
    225             $html = '<textarea rows="4" cols="40" id="tgsmsnotify_sendSMS_messageTemplate_field" name="tgsmsnotify_setting_section[smsMessage]"> </textarea>';
    226 
    227         echo  $html ;
    228     }
    229 
    230     function tgsmsnotify_sendSMS_callback() {
    231         $options = get_option( 'tgsmsnotify_setting_section' );
    232      
    233         if ( isset ( $options['toManager'] ) ) {
    234             $html = '<input type="checkbox" id="tgsmsnotify_sendSMS_field" name="tgsmsnotify_setting_section[toManager]" value="1"' . checked( 1, $options['toManager'], false ) . ' />';
    235             $html .= '<label for="tgsmsnotify_sendSMS_field">Notify Manager</label><br>';           
    236         } else {
    237             $html = '<input type="checkbox" id="tgsmsnotify_sendSMS_field" name="tgsmsnotify_setting_section[toManager]" />';
    238             $html .= '<label for="tgsmsnotify_sendSMS_field">Notify Manager</label><br>';           
    239         }
    240 
    241         echo  $html ;
    242     }
    243 
    244     function tgsmsnotify_sendSMS_newProduct_callback () {
    245         $options = get_option( 'tgsmsnotify_setting_section' );
    246 
    247         if ( isset ( $options['smsNewProduct'] ) ) {
    248             $html = '<input type="checkbox" id="tgsmsnotify_sendSMS_newProduct_field" name="tgsmsnotify_setting_section[smsNewProduct]" value="1"' . checked( 1, $options['smsNewProduct'], false ) . ' />';
    249             $html .= '<label for="tgsmsnotify_sendSMS_newProduct_field">Notify on new Product Add</label><br>';
    250         } else {
    251             $html = '<input type="checkbox" id="tgsmsnotify_sendSMS_newProduct_field" name="tgsmsnotify_setting_section[smsNewProduct]" />';
    252             $html .= '<label for="tgsmsnotify_sendSMS_newProduct_field">Notify on new Product Add</label><br>';           
    253         }
    254 
    255         echo  $html ;
    256     }
    257 
    258     function tgsmsnotify_sendSMS_newProductMessage_callback () {
    259         $options = get_option( 'tgsmsnotify_setting_section' );
    260 
    261         if ( isset ( $options['smsNewProductMessage']) )
    262             $html = '<textarea rows="4" cols="40" id="tgsmsnotify_sendSMS_newProductMessage_field" name="tgsmsnotify_setting_section[smsNewProductMessage]">' . esc_textarea( $options['smsNewProductMessage'] ) . '</textarea>';
    263         else
    264             $html = '<textarea rows="4" cols="40" id="tgsmsnotify_sendSMS_newProductMessage_field" name="tgsmsnotify_setting_section[smsNewProductMessage]"> </textarea>';
    265 
    266         echo  $html ;
    267     }
    268 
    269     function tgsmsnotify_sendSMS_priceChange_callback () {
    270         $options = get_option( 'tgsmsnotify_setting_section' );
    271 
    272         if ( isset ( $options['smsPriceChange']) ) {
    273             $html = '<input type="checkbox" id="tgsmsnotify_sendSMS_priceChange_field" name="tgsmsnotify_setting_section[smsPriceChange]" value="1"' . checked( 1, $options['smsPriceChange'], false ) . ' />';
    274             $html .= '<label for="tgsmsnotify_sendSMS_priceChange_field">Notify on Price Change</label><br>';
    275         } else {
    276             $html = '<input type="checkbox" id="tgsmsnotify_sendSMS_priceChange_field" name="tgsmsnotify_setting_section[smsPriceChange]" />';
    277             $html .= '<label for="tgsmsnotify_sendSMS_priceChange_field">Notify on Price Change</label><br>';           
    278         }
    279 
    280         echo $html ;
    281     }
    282 
    283     function tgsmsnotify_sendSMS_priceChangeMessage_callback () {
    284         $options = get_option( 'tgsmsnotify_setting_section' );
    285 
    286         if ( isset ( $options['smsPriceChangeMessage'] ) )
    287             $html = '<textarea rows="4" cols="40" id="tgsmsnotify_sendSMS_priceChangeMessage_field" name="tgsmsnotify_setting_section[smsPriceChangeMessage]">' . esc_textarea( $options['smsPriceChangeMessage'] ) . '</textarea>';
    288         else
    289             $html = '<textarea rows="4" cols="40" id="tgsmsnotify_sendSMS_priceChangeMessage_field" name="tgsmsnotify_setting_section[smsPriceChangeMessage]"> </textarea>';
    290 
    291         echo $html ;
    292     }
    293 
    294     function tgsmsnotify_sendSMS_qtyAlert_callback () {
    295         $options = get_option( 'tgsmsnotify_setting_section' );
    296 
    297         if ( isset ($options['smsQtyAlert'] ) ) {
    298             $html = '<input type="checkbox" id="tgsmsnotify_sendSMS_qtyAlert_field" name="tgsmsnotify_setting_section[smsQtyAlert]" value="1"' . checked( 1, $options['smsQtyAlert'], false ) . ' />';
    299             $html .= '<label for="tgsmsnotify_sendSMS_qtyAlert_field">Notify on Quantity Below Threshold</label><br>';
    300         } else {
    301             $html = '<input type="checkbox" id="tgsmsnotify_sendSMS_qtyAlert_field" name="tgsmsnotify_setting_section[smsQtyAlert]" />';
    302             $html .= '<label for="tgsmsnotify_sendSMS_qtyAlert_field">Notify on Quantity Below Threshold</label><br>';           
    303         }
    304 
    305         echo $html ;
    306     }
    307 
    308     function tgsmsnotify_sendSMS_qtyThreshold_callback () {
    309         $options = get_option( 'tgsmsnotify_setting_section' );
    310        
    311         if ( isset ( $options['smsQtyThreshold'] ) )
    312             $html = '<input type="number" id="tgsmsnotify_sendSMS_qtyThreshold_field" name="tgsmsnotify_setting_section[smsQtyThreshold]" value="' . intval ($options['smsQtyThreshold']) . '" />';
    313         else
    314         $html = '<input type="number" id="tgsmsnotify_sendSMS_qtyThreshold_field" name="tgsmsnotify_setting_section[smsQtyThreshold]" />';
    315261
    316262        echo $html ;
     
    328274    }
    329275
    330     function tgsmsnotify_sanitize ( $input ) {                   // prfx_sanitize_options( $input ) {
     276   
     277   
     278    /* add_action( 'admin_init', 'tgsmsnotify_settings_init' );
     279   
     280    function tgsmsnotify_settings_init() {
     281       
     282       
     283           
     284        }
     285    } */
     286
     287     function tgsmsnotify_setting_section_callback_function() {
     288        require_once('notifycore.php');
     289
     290        if ( isset ( $_GET["tab"] ) && ( $_GET["tab"] == "manager-options" ) ) {
     291            $html = '<p>Set up your Manager Options here</p>';
     292            echo $html ;
     293        }
     294    }
     295
     296    function tgsmsnotify_sendSMS_managerNumber_field_callback() {
     297        $options = get_option( 'tgsmsnotify_setting_section' );
     298
     299        if ( isset ( $options['manager_number'] ) ) {
     300            $html = '<input type="text" id="tgsmsnotify_sendSMS_managerNumber_field" name="tgsmsnotify_setting_section[manager_number]" value="' . intval ($options['manager_number']) . '" />';
     301            $html .= '<br><p><i>With country code prefixed</i></p>';
     302        } else {
     303            $html = '<input type="text" id="tgsmsnotify_sendSMS_managerNumber_field" name="tgsmsnotify_setting_section[manager_number]" />';
     304            $html .= '<br><p><i>With country code prefixed</i></p>';
     305        }
     306        echo $html ;
     307    }
     308
     309    function tgsmsnotify_sendSMS_messageTemplate_callback() {
     310        $options = get_option( 'tgsmsnotify_setting_section' );
     311
     312        if ( isset ( $options['smsMessage'] ) )
     313            $html = '<textarea rows="4" cols="40" id="tgsmsnotify_sendSMS_messageTemplate_field" name="tgsmsnotify_setting_section[smsMessage]">' . esc_textarea( $options['smsMessage'] ) . '</textarea>';
     314        else
     315            $html = '<textarea rows="4" cols="40" id="tgsmsnotify_sendSMS_messageTemplate_field" name="tgsmsnotify_setting_section[smsMessage]"> </textarea>';
     316
     317        echo  $html ;
     318    }
     319
     320    function tgsmsnotify_sendSMS_callback() {
     321        $options = get_option( 'tgsmsnotify_setting_section' );
     322     
     323        if ( isset ( $options['toManager'] ) ) {
     324            $html = '<input type="checkbox" id="tgsmsnotify_sendSMS_field" name="tgsmsnotify_setting_section[toManager]" value="1"' . checked( 1, $options['toManager'], false ) . ' />';
     325            $html .= '<label for="tgsmsnotify_sendSMS_field">Notify on new Post Add</label><br>';           
     326        } else {
     327            $html = '<input type="checkbox" id="tgsmsnotify_sendSMS_field" name="tgsmsnotify_setting_section[toManager]" />';
     328            $html .= '<label for="tgsmsnotify_sendSMS_field">Notify on new Post Add</label><br>';           
     329        }
     330
     331        echo  $html ;
     332    }
     333
     334    function tgsmsnotify_sendSMS_newProduct_callback () {
     335        $options = get_option( 'tgsmsnotify_setting_section' );
     336
     337        if ( isset ( $options['smsNewProduct'] ) ) {
     338            $html = '<input type="checkbox" id="tgsmsnotify_sendSMS_newProduct_field" name="tgsmsnotify_setting_section[smsNewProduct]" value="1"' . checked( 1, $options['smsNewProduct'], false ) . ' />';
     339            $html .= '<label for="tgsmsnotify_sendSMS_newProduct_field">Notify on new Product Add</label><br>';
     340        } else {
     341            $html = '<input type="checkbox" id="tgsmsnotify_sendSMS_newProduct_field" name="tgsmsnotify_setting_section[smsNewProduct]" />';
     342            $html .= '<label for="tgsmsnotify_sendSMS_newProduct_field">Notify on new Product Add</label><br>';           
     343        }
     344
     345        echo  $html ;
     346    }
     347
     348    function tgsmsnotify_sendSMS_newProductMessage_callback () {
     349        $options = get_option( 'tgsmsnotify_setting_section' );
     350
     351        if ( isset ( $options['smsNewProductMessage']) )
     352            $html = '<textarea rows="4" cols="40" id="tgsmsnotify_sendSMS_newProductMessage_field" name="tgsmsnotify_setting_section[smsNewProductMessage]">' . esc_textarea( $options['smsNewProductMessage'] ) . '</textarea>';
     353        else
     354            $html = '<textarea rows="4" cols="40" id="tgsmsnotify_sendSMS_newProductMessage_field" name="tgsmsnotify_setting_section[smsNewProductMessage]"> </textarea>';
     355
     356        echo  $html ;
     357    }
     358
     359    function tgsmsnotify_sendSMS_priceChange_callback () {
     360        $options = get_option( 'tgsmsnotify_setting_section' );
     361
     362        if ( isset ( $options['smsPriceChange']) ) {
     363            $html = '<input type="checkbox" id="tgsmsnotify_sendSMS_priceChange_field" name="tgsmsnotify_setting_section[smsPriceChange]" value="1"' . checked( 1, $options['smsPriceChange'], false ) . ' />';
     364            $html .= '<label for="tgsmsnotify_sendSMS_priceChange_field">Notify on Price Change</label><br>';
     365        } else {
     366            $html = '<input type="checkbox" id="tgsmsnotify_sendSMS_priceChange_field" name="tgsmsnotify_setting_section[smsPriceChange]" />';
     367            $html .= '<label for="tgsmsnotify_sendSMS_priceChange_field">Notify on Price Change</label><br>';           
     368        }
     369
     370        echo $html ;
     371    }
     372
     373    function tgsmsnotify_sendSMS_priceChangeMessage_callback () {
     374        $options = get_option( 'tgsmsnotify_setting_section' );
     375
     376        if ( isset ( $options['smsPriceChangeMessage'] ) )
     377            $html = '<textarea rows="4" cols="40" id="tgsmsnotify_sendSMS_priceChangeMessage_field" name="tgsmsnotify_setting_section[smsPriceChangeMessage]">' . esc_textarea( $options['smsPriceChangeMessage'] ) . '</textarea>';
     378        else
     379            $html = '<textarea rows="4" cols="40" id="tgsmsnotify_sendSMS_priceChangeMessage_field" name="tgsmsnotify_setting_section[smsPriceChangeMessage]"> </textarea>';
     380
     381        echo $html ;
     382    }
     383
     384    function tgsmsnotify_sendSMS_qtyAlert_callback () {
     385        $options = get_option( 'tgsmsnotify_setting_section' );
     386
     387        if ( isset ($options['smsQtyAlert'] ) ) {
     388            $html = '<input type="checkbox" id="tgsmsnotify_sendSMS_qtyAlert_field" name="tgsmsnotify_setting_section[smsQtyAlert]" value="1"' . checked( 1, $options['smsQtyAlert'], false ) . ' />';
     389            $html .= '<label for="tgsmsnotify_sendSMS_qtyAlert_field">Notify on Quantity Below Threshold</label><br>';
     390        } else {
     391            $html = '<input type="checkbox" id="tgsmsnotify_sendSMS_qtyAlert_field" name="tgsmsnotify_setting_section[smsQtyAlert]" />';
     392            $html .= '<label for="tgsmsnotify_sendSMS_qtyAlert_field">Notify on Quantity Below Threshold</label><br>';           
     393        }
     394
     395        echo $html ;
     396    }
     397
     398    function tgsmsnotify_sendSMS_qtyThreshold_callback () {
     399        $options = get_option( 'tgsmsnotify_setting_section' );
     400       
     401        if ( isset ( $options['smsQtyThreshold'] ) )
     402            $html = '<input type="number" id="tgsmsnotify_sendSMS_qtyThreshold_field" name="tgsmsnotify_setting_section[smsQtyThreshold]" value="' . intval ($options['smsQtyThreshold']) . '" />';
     403        else
     404        $html = '<input type="number" id="tgsmsnotify_sendSMS_qtyThreshold_field" name="tgsmsnotify_setting_section[smsQtyThreshold]" />';
     405
     406        echo $html ;
     407    }
     408
     409   
     410   
     411    /* add_action( 'admin_init', 'tgsmsnotify_customer_settings_init' );
     412   
     413    function tgsmsnotify_customer_settings_init() {
     414       
     415       
     416
     417           
     418        }
     419    } */
     420
     421     function tgsmsnotify_customer_setting_section_callback_function() {
     422
     423        if ( isset ( $_GET["tab"] ) && ( $_GET["tab"] == "customer-options" ) ) {
     424            $html = '<p>Set up your Customer Notification Options here</p>';
     425            echo $html ;
     426        }
     427    }
     428
     429    function tgsmsnotify_sendSMS_onOrderProcessing_callback () {
     430        $options = get_option( 'tgsmsnotify_setting_section' );
     431
     432        if ( isset ( $options['smsonOrderProcessing']) ) {
     433            $html = '<input type="checkbox" id="tgsmsnotify_sendSMS_onOrderProcessing_field" name="tgsmsnotify_setting_section[smsonOrderProcessing]" value="1"' . checked( 1, $options['smsonOrderProcessing'], false ) . ' />';
     434            $html .= '<label for="tgsmsnotify_sendSMS_onOrderProcessing_field">Notify Customer on Order Processing</label><br>';
     435        } else {
     436            $html = '<input type="checkbox" id="tgsmsnotify_sendSMS_onOrderProcessing_field" name="tgsmsnotify_setting_section[smsonOrderProcessing]" />';
     437            $html .= '<label for="tgsmsnotify_sendSMS_onOrderProcessing_field">Notify Customer on Order Processing</label><br>';           
     438        }
     439
     440        echo $html ;
     441    }
     442
     443    function tgsmsnotify_sendSMS_onOrderProcessing_Message_field_callback () {
     444        $options = get_option( 'tgsmsnotify_setting_section' );
     445
     446        if ( isset ( $options['smsonOrderProcessingMessage'] ) )
     447            $html = '<textarea rows="4" cols="40" id="tgsmsnotify_sendSMS_onOrderProcessing_Message_field" name="tgsmsnotify_setting_section[smsonOrderProcessingMessage]">' . esc_textarea( $options['smsonOrderProcessingMessage'] ) . '</textarea>';
     448        else
     449            $html = '<textarea rows="4" cols="40" id="tgsmsnotify_sendSMS_onOrderProcessing_Message_field" name="tgsmsnotify_setting_section[smsonOrderProcessingMessage]"> </textarea>';
     450
     451        echo $html ;
     452    }
     453
     454    function tgsmsnotify_sendSMS_onOrderCompleted_callback () {
     455        $options = get_option( 'tgsmsnotify_setting_section' );
     456
     457        if ( isset ( $options['smsonOrderCompleted']) ) {
     458            $html = '<input type="checkbox" id="tgsmsnotify_sendSMS_onOrderCompleted_field" name="tgsmsnotify_setting_section[smsonOrderCompleted]" value="1"' . checked( 1, $options['smsonOrderCompleted'], false ) . ' />';
     459            $html .= '<label for="tgsmsnotify_sendSMS_onOrderCompleted_field">Notify Customer on Order Completed</label><br>';
     460        } else {
     461            $html = '<input type="checkbox" id="tgsmsnotify_sendSMS_onOrderCompleted_field" name="tgsmsnotify_setting_section[smsonOrderCompleted]" />';
     462            $html .= '<label for="tgsmsnotify_sendSMS_onOrderCompleted_field">Notify Customer on Order Completed</label><br>';           
     463        }
     464
     465        echo $html ;
     466    }
     467
     468    function tgsmsnotify_sendSMS_onOrderCompleted_Message_field_callback () {
     469        $options = get_option( 'tgsmsnotify_setting_section' );
     470
     471        if ( isset ( $options['smsonOrderCompletedMessage'] ) )
     472            $html = '<textarea rows="4" cols="40" id="tgsmsnotify_sendSMS_onOrderCompleted_Message_field" name="tgsmsnotify_setting_section[smsonOrderCompletedMessage]">' . esc_textarea( $options['smsonOrderCompletedMessage'] ) . '</textarea>';
     473        else
     474            $html = '<textarea rows="4" cols="40" id="tgsmsnotify_sendSMS_onOrderCompleted_Message_field" name="tgsmsnotify_setting_section[smsonOrderCompletedMessage]"> </textarea>';
     475
     476        echo $html ;
     477    }
     478
     479    function tgsmsnotify_sanitize_twilio ( $input ) {                   // prfx_sanitize_options( $input ) {
    331480        $options = get_option('tgsmsnotify_setting_section');
     481       
     482        $tginput = (array) get_option( 'tgsmsnotify_setting_section' );
     483               
     484         /* ob_start();                    // start buffer capture
     485        var_dump( $tginput );           // dump the values
     486        $contents = ob_get_contents(); // put the buffer into a variable
     487        ob_end_clean();                // end capture
     488        error_log($contents);   */
     489
    332490        if ( empty ($input['twilio_sid']) ) {
    333491            if ( isset ( $options['twilio_sid'] ) )
    334                 $input['twilio_sid'] = $options['twilio_sid'];
     492                $tginput['twilio_sid'] = $options['twilio_sid'];
    335493            else
    336                 $input['twilio_sid'] = '';
     494                $tginput['twilio_sid'] = '';
    337495        }
    338496
    339497        if ( empty ($input['twilio_auth']) ) {
    340498            if ( isset ( $options['twilio_auth'] ) )
    341                 $input['twilio_auth'] = $options['twilio_auth'];
     499                $tginput['twilio_auth'] = $options['twilio_auth'];
    342500            else
    343                 $input['twilio_auth'] = '';
    344         }
    345 
    346         $input['twilio_from'] = intval ($input['twilio_from']);
    347        
    348         $input['manager_number'] = intval ( $input['manager_number'] );
    349         $input['smsMessage'] = esc_textarea( $input['smsMessage'] );
    350         $input['toManager'] =  intval( $input['toManager'] );
    351 
    352         $input['smsNewProduct'] = intval( $input['smsNewProduct'] );
    353         $input['smsNewProductMessage'] = esc_textarea( $input['smsNewProductMessage'] );
    354         $input['smsPriceChange'] = intval( $input['smsPriceChange'] );
    355         $input['smsPriceChangeMessage'] = esc_textarea( $input['smsPriceChangeMessage'] );
    356         $input['smsQtyAlert'] = intval( $input['smsQtyAlert'] );
    357         $input['smsQtyThreshold'] = intval( $input['smsQtyThreshold'] );
    358         $input['deleteTGSMSdata'] =  intval( $input['deleteTGSMSdata'] );
    359 
    360         return $input;
     501                $tginput['twilio_auth'] = '';
     502        }
     503
     504        if ( isset ( $input['twilio_from'] ) ) $tginput['twilio_from'] = intval ($input['twilio_from']); else error_log('From number UNSET');
     505        if ( isset ( $input['deleteTGSMSdata'] ) )
     506            $tginput['deleteTGSMSdata'] = ( intval( $input['deleteTGSMSdata'] ) == 1 ? 1 : 0 );
     507        else
     508            $tginput['deleteTGSMSdata'] = 0;
     509
     510        return $tginput;
     511    }
     512       
     513    function tgsmsnotify_sanitize_manager ( $input ) {
     514       
     515        $tginput = (array) get_option( 'tgsmsnotify_setting_section' );
     516
     517        if ( isset ( $input['manager_number'] ) ) $tginput['manager_number'] = intval ( $input['manager_number'] );
     518        if ( isset ( $input['smsMessage'] ) ) $tginput['smsMessage'] = esc_textarea( $input['smsMessage'] );
     519
     520        if ( isset ( $input['toManager'] ) )
     521            $tginput['toManager'] = ( intval( $input['toManager'] ) == 1 ? 1 : 0 );
     522        else
     523            $tginput['toManager'] = 0;
     524
     525        if ( isset ( $input['smsNewProduct'] ) )
     526            $tginput['smsNewProduct'] = ( intval( $input['smsNewProduct'] ) == 1 ? 1 : 0 );
     527        else
     528            $tginput['smsNewProduct'] = 0;
     529
     530        if ( isset ( $input['smsNewProductMessage'] ) ) $tginput['smsNewProductMessage'] = esc_textarea( $input['smsNewProductMessage'] );
     531       
     532        if ( isset ( $input['smsPriceChange'] ) )
     533            $tginput['smsPriceChange'] = ( intval( $input['smsPriceChange'] ) == 1 ? 1 : 0 );
     534        else
     535            $tginput['smsPriceChange'] = 0;
     536
     537        if ( isset ( $input['smsPriceChangeMessage'] ) ) $tginput['smsPriceChangeMessage'] = esc_textarea( $input['smsPriceChangeMessage'] );
     538       
     539        if ( isset ( $input['smsQtyAlert'] ) )
     540            $tginput['smsQtyAlert'] = ( intval( $input['smsQtyAlert'] ) == 1 ? 1 : 0 );
     541        else
     542        $tginput['smsQtyAlert'] = 0;
     543
     544        if ( isset ( $input['smsQtyThreshold'] ) ) $tginput['smsQtyThreshold'] = intval( $input['smsQtyThreshold'] );
     545
     546        return $tginput;
     547    }
     548
     549    function print_errors(){
     550        settings_errors( 'unique_identifyer' );
     551    }
     552
     553    function tgsmsnotify_sanitize_customer ( $input ) {
     554
     555        $tginput = (array) get_option( 'tgsmsnotify_setting_section' );
     556
     557        if ( isset ( $input['smsonOrderProcessing'] ) )
     558            $tginput['smsonOrderProcessing'] = ( intval( $input['smsonOrderProcessing'] ) == 1 ? 1 : 0 );
     559        else
     560        $tginput['smsonOrderProcessing'] = 0;
     561
     562        if ( isset ( $input['smsonOrderProcessingMessage'] ) ) $tginput['smsonOrderProcessingMessage'] = esc_textarea( $input['smsonOrderProcessingMessage'] );
     563
     564        if ( isset ( $input['smsonOrderCompleted'] ) )
     565            $tginput['smsonOrderCompleted'] = ( intval( $input['smsonOrderCompleted'] ) == 1 ? 1 : 0 );
     566        else
     567            $tginput['smsonOrderCompleted'] = 0;
     568       
     569        if ( isset ( $input['smsonOrderCompletedMessage'] ) ) $tginput['smsonOrderCompletedMessage'] = esc_textarea( $input['smsonOrderCompletedMessage'] );
     570
     571        return $tginput;
    361572    }
    362573
    363574    function tgsmsnotify_settings_page() {
    364575        ?>
    365         <form action='options.php' method='POST'>   
     576
     577        <div class="wrap">
     578            <div id="icon-options-general" class="icon32"></div>
     579            <h1>TG SMS Notify Settings</h1>
     580
     581            <?php //settings_errors(); ?>
     582
    366583            <?php
    367             settings_fields( 'tgsmsnotify_settings_page' );
    368             do_settings_sections( 'tgsmsnotify_settings_page' );
    369             submit_button();
     584
     585            $active_tab = isset( $_REQUEST['tab'] ) ? $_REQUEST['tab'] : 'sms-sender-settings';
     586            /*$active_tab = 'sms-sender-settings';
     587            if( isset( $_GET[ 'tab' ] ) ) {
     588                $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'sms-sender-settings';
     589            } // end if
     590            */
     591            ?>
     592
     593            <!-- wordpress provides the styling for tabs. -->
     594            <h2 class="nav-tab-wrapper">
     595                <!-- when tab buttons are clicked we jump back to the same page but with a new parameter that represents the clicked tab. accordingly we make it active -->
     596                <a href="?page=tgsmsnotify-main-settings&tab=sms-sender-settings" class="nav-tab <?php echo $active_tab == 'sms-sender-settings' ? 'nav-tab-active' : ''; ?>">SMS Sender Settings</a>
     597               
     598                <a href="?page=tgsmsnotify-main-settings&tab=manager-options" class="nav-tab <?php echo $active_tab == 'manager-options' ? 'nav-tab-active' : ''; ?>">Manager Settings</a>
     599               
     600                <a href="?page=tgsmsnotify-main-settings&tab=customer-options" class="nav-tab <?php echo $active_tab == 'customer-options' ? 'nav-tab-active' : ''; ?>">Customer Settings</a>
     601            </h2>
     602
    370603           
    371             ?>
    372    
    373         </form>
    374         <?php
    375     }
    376 ?>
     604            <form method="post" action="<?php echo esc_url( add_query_arg( 'tab', $active_tab, admin_url( 'options.php' ) ) ); ?>">
     605               
     606                <?php
     607               
     608                if ( $active_tab == 'sms-sender-settings' ) {
     609                    error_log('1st tab values');
     610                    settings_fields( 'tgsmsnotify_twilio_setting_section' );
     611                    do_settings_sections( 'tgsmsnotify_twilio_settings_page' );
     612                } else if ( $active_tab == 'manager-options' ) {
     613                    error_log('end tab values');
     614                    settings_fields( 'tgsmsnotify_setting_section' );
     615                    do_settings_sections( 'tgsmsnotify_manager_settings_page' );
     616                } else if ( $active_tab == 'customer-options' ) {
     617                    error_log('3rd tab values');
     618                    settings_fields( 'tgsmsnotify_customer_setting_section' );
     619                    do_settings_sections( 'tgsmsnotify_customer_settings_page' );
     620                }
     621
     622                //settings_fields( 'tgsmsnotify_settings_page' );
     623                //do_settings_sections( 'tgsmsnotify_settings_page' );
     624                //echo '<input type="hidden" name="tab" value="' . esc_attr( $active_tab ) . '" />';
     625                submit_button();
     626                ?>
     627       
     628            </form>
     629        </div>
     630<?php
     631    }?>
  • tg-sms-notify/trunk/readme.txt

    r2358813 r2376039  
    1 === TG Send SMS Notifications for Wordpress and WooCommerce Twilio ===
     1=== TG SMS Notify ===
    22Contributors: burfbari
    33Donate link:
    44Tags: notifications, wordpress, woocommerce, sms, twilio
    55Requires at least: 4.7
    6 Tested up to: 5.5
     6Tested up to: 5.4.2
    77Stable tag: 1.0
    88Requires PHP: 5.2.4
     
    6767Please drop us an email at [email protected] and we'd get in touch if that may be possible.
    6868
    69 == Screenshots ==
    70 
    71 1. Set your messages here. Settings > TGSMS Notify
    72 
    7369== Changelog ==
    7470
  • tg-sms-notify/trunk/tg-wp-sms-notify.php

    r2358686 r2376039  
    1717    define( 'TGSMSNOTIFY__PLUGIN_NOTIFYCORE', plugin_dir_path( __FILE__ ) );
    1818    define( 'TGSMSNOTIFY__PLUGIN_NOTIFYCOREWOOCOMMERCE', plugin_dir_path( __FILE__ ) );
     19    define( 'TGSMSNOTIFY__PLUGIN_NOTIFYWCCUSTOMERS', plugin_dir_path( __FILE__ ) );
    1920
    2021    require_once( TGSMSNOTIFY__PLUGIN_SETTINGS . './includes/settings.php' );
    2122    require_once( TGSMSNOTIFY__PLUGIN_NOTIFYCORE . './includes/notifycore.php' );
    2223    require_once( TGSMSNOTIFY__PLUGIN_NOTIFYCOREWOOCOMMERCE . './includes/notifywoocommerce.php' );
     24    require_once( TGSMSNOTIFY__PLUGIN_NOTIFYWCCUSTOMERS . './includes/notifywccustomers.php' );
    2325
    2426    function tgsmsnotify_my_plugin_activate() {
     
    3739        }
    3840    }
    39     add_action( 'admin_init', 'tgsmsnotify_load_plugin' );
     41
     42    add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'tgsmsnotify_add_action_links' );
    4043   
     44    function tgsmsnotify_add_action_links ( $links ) {
     45
     46        $tgsmsnotify_links = array(
     47            '<a href="' . admin_url( 'options-general.php?page=tgsmsnotify-main-settings' ) . '">Settings</a>',
     48        );
     49
     50        return array_merge( $tgsmsnotify_links, $links );
     51    }
    4152?>
Note: See TracChangeset for help on using the changeset viewer.