Plugin Directory

Changeset 1821515


Ignore:
Timestamp:
02/13/2018 05:21:16 PM (8 years ago)
Author:
raiserweb
Message:

fixed plugin activation issue

Location:
order-emails-log-for-woocommerce/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • order-emails-log-for-woocommerce/trunk/email-log.php

    r1604485 r1821515  
    99    private $order_id;
    1010 
    11     static function installDatabaseTables() {
    12        
    13         global $wpdb;
    14        
    15         require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
    16      
    17         $charset_collate = $wpdb->get_charset_collate();       
    18        
    19         $tableName = self::table_name();
    20        
    21         $wpdb->query("CREATE TABLE IF NOT EXISTS `$tableName` (
    22                 `id` INT NOT NULL AUTO_INCREMENT,
    23                 `order_id` INT NOT NULL,
    24                 `timestamp` DATETIME NOT NULL,
    25                 `host` VARCHAR(200) NULL ,
    26                 `receiver` VARCHAR(200) NOT NULL DEFAULT '0',
    27                 `subject` VARCHAR(400) NOT NULL DEFAULT '0',
    28                 `message` TEXT NULL,
    29                 `headers` TEXT NULL,
    30                 `attachments` VARCHAR(800) NULL ,
    31                 `meta1` TEXT NULL,
    32                 `meta2` TEXT NULL,
    33                 PRIMARY KEY (`id`)
    34             ) {$charset_collate};");
    35                    
    36     }
    37 
    3811    static function unInstallDatabaseTables() {
    3912        global $wpdb;
  • order-emails-log-for-woocommerce/trunk/order-emails-log-for-woocommerce.php

    r1604485 r1821515  
    44 * Plugin URI:
    55 * Description: Logs sent emails related to orders, and displays them in a table on the order screen.
    6  * Version:  1.1
     6 * Version:  1.2
    77 * Author: RaiserWeb
    88 * Author URI: http://www.raiserweb.com
     
    3232}
    3333
    34 
     34include( 'email-log.php' );
     35       
    3536add_action( 'plugins_loaded', 'WOEL_plugin_init', 0 );
    3637function WOEL_plugin_init(){
     
    4950        }   
    5051
    51    
    5252        // include plugin files
    53         include( 'email-log.php' );
    54         include( 'settings.php' );
    55        
    56         // install table on activation
    57         register_activation_hook( __FILE__, array( 'WOEL_Email_Log', 'installDatabaseTables' ) );
    58 
    59        
     53        include( 'settings.php' );     
     54     
    6055        // init the email log filter and actions
    6156        $WOEL_Email_Log = new WOEL_Email_Log;
    6257        $WOEL_Email_Log->addFilterActions();
    63        
    64        
    65        
     58           
    6659        // Add Meta container admin shop_order pages
    6760        add_action( 'add_meta_boxes', 'WOEL_add_meta_box_edit_order_page' );
     
    8073            return $methods;
    8174        }
    82         add_filter('woocommerce_integrations', 'add_WOEL_settings_integration' );     
    83                
    84 
    85 
     75        add_filter('woocommerce_integrations', 'add_WOEL_settings_integration' );                   
    8676       
    8777    }
     
    8979}
    9080   
     81   
     82// plugin activation
     83function WOEL_installDatabaseTables() {
     84
     85    global $wpdb;
     86   
     87    require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
     88 
     89    $charset_collate = $wpdb->get_charset_collate();       
     90   
     91    $tableName = WOEL_Email_Log::table_name();
     92
     93    $wpdb->query("CREATE TABLE IF NOT EXISTS `$tableName` (
     94            `id` INT NOT NULL AUTO_INCREMENT,
     95            `order_id` INT NOT NULL,
     96            `timestamp` DATETIME NOT NULL,
     97            `host` VARCHAR(200) NULL ,
     98            `receiver` VARCHAR(200) NOT NULL DEFAULT '0',
     99            `subject` VARCHAR(400) NOT NULL DEFAULT '0',
     100            `message` TEXT NULL,
     101            `headers` TEXT NULL,
     102            `attachments` VARCHAR(800) NULL ,
     103            `meta1` TEXT NULL,
     104            `meta2` TEXT NULL,
     105            PRIMARY KEY (`id`)
     106        ) {$charset_collate};");
     107               
     108}
     109register_activation_hook( __FILE__, 'WOEL_installDatabaseTables' );
Note: See TracChangeset for help on using the changeset viewer.