Esempio n. 1
0
 /**
  * Installation. Runs on activation.
  * @access  public
  * @since    2.7.0
  * @return  void
  */
 public function install($networkwide)
 {
     global $wpdb;
     if (function_exists('is_multisite') && is_multisite()) {
         // check if it is a network activation - if so, run the activation function for each blog id
         if ($networkwide) {
             $old_blog = $wpdb->blogid;
             // Get all blog ids
             $blogids = $wpdb->get_col("SELECT blog_id FROM {$wpdb->blogs}");
             foreach ($blogids as $blog_id) {
                 switch_to_blog($blog_id);
                 WC_CRM_Install::install();
             }
             switch_to_blog($old_blog);
             return;
         }
     } else {
         WC_CRM_Install::install();
     }
 }
        return (array) $links;
    }
    /**
     * Uninstall tables when MU blog is deleted.
     * @param  array $tables
     * @return array
     */
    public static function wpmu_drop_tables($tables)
    {
        global $wpdb;
        $tables[] = $wpdb->prefix . 'wc_crm_log';
        $tables[] = $wpdb->prefix . 'wc_crm_groups';
        $tables[] = $wpdb->prefix . 'wc_crm_groups_relationships';
        $tables[] = $wpdb->prefix . 'wc_crm_customer_list';
        $tables[] = $wpdb->prefix . 'wc_crm_statuses';
        return $tables;
    }
    public function new_blog($blog_id, $user_id, $domain, $path, $site_id, $meta)
    {
        global $wpdb;
        $crm_path = basename(WC_CRM_FILE);
        if (is_plugin_active_for_network($crm_path . '/woocommerce-crm.php')) {
            $old_blog = $wpdb->blogid;
            switch_to_blog($blog_id);
            self::install();
            switch_to_blog($old_blog);
        }
    }
}
WC_CRM_Install::init();