From 7a9ca4d88859659c832a70cab4d37763d0c41733 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Thu, 6 Dec 2012 15:51:20 +0000 Subject: [PATCH] Sahreyourcart evilness. Closes #1934. --- .../shareyourcart/class-wc-shareyourcart.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/classes/integrations/shareyourcart/class-wc-shareyourcart.php b/classes/integrations/shareyourcart/class-wc-shareyourcart.php index 7789c4f7e16..c40c1179512 100644 --- a/classes/integrations/shareyourcart/class-wc-shareyourcart.php +++ b/classes/integrations/shareyourcart/class-wc-shareyourcart.php @@ -22,8 +22,11 @@ class WC_ShareYourCart extends WC_Integration { // Load the settings. $this->settings = ( array ) get_option( $this->plugin_id . $this->id . '_settings' ); //do not rely on the base implementation of init_settings - //the classes need to be initialized - $this->init_share_your_cart(); + if ( isset( $this->settings['enabled'] ) && $this->settings['enabled'] == 'yes' ) { + + //the classes need to be initialized + $this->init_share_your_cart(); + } //hook to the admin settings page add_action( 'woocommerce_update_options_integration_shareyourcart', array( &$this, 'process_forms') ); @@ -69,6 +72,7 @@ class WC_ShareYourCart extends WC_Integration { function process_forms() { //after this function completes, WooCommerce will refresh the page, so we need to save the data here + $this->init_share_your_cart(); //stripslashes from button_html if(isset($_POST['button_html'])) @@ -90,6 +94,8 @@ class WC_ShareYourCart extends WC_Integration { */ function admin_options() { + $this->init_share_your_cart(); + if ( $this->shareYourCartWooCommerce->isActive() ) { // call this manually ( to determine if there needs to be a table update, or not )