From 6d28ef723ecb34b39e559d401ede5e4698fd179e Mon Sep 17 00:00:00 2001 From: Stuart Duff Date: Mon, 5 Sep 2016 21:38:57 +0100 Subject: [PATCH] * Fix - Added check to prevent wc_add_notice() from trying to display on admin. Closes #7 --- README.md | 3 +++ readme.txt | 5 ++++- woocommerce-dynamic-pricing-table.php | 9 ++++++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c2a6cc6..b065ed9 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,9 @@ All support requests for this extension should be posted to the [WooCommerce Dyn ## Changelog +**1.0.5 - 05/09/16** +* Fix - Added check to prevent wc_add_notice() from trying to display on admin. + **1.0.4 - 30/08/16** * Feature - Added the ability to display [Simple Category Pricing](https://docs.woocommerce.com/document/woocommerce-dynamic-pricing/#section-4) discounts on WooCommerce categories. diff --git a/readme.txt b/readme.txt index f0d7fc6..00b5fc1 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: stuartduff Tags: ecommerce, e-commerce, store, sales, sell, shop, cart, checkout, storefront Requires at least: 4.5 Tested up to: 4.5.2 -Stable tag: 1.0.4 +Stable tag: 1.0.5 License: GPLv3 License URI: https://www.gnu.org/licenses/gpl-3.0.html @@ -31,6 +31,9 @@ Below are the discounts that the plugin will currently display. == Changelog == += 1.0.5 - 05/09/16 = +* Fix - Added check to prevent wc_add_notice() from trying to display on admin. + = 1.0.4 - 30/08/16 = * Feature - Added the ability to display Simple Category Pricing discounts on WooCommerce categories. diff --git a/woocommerce-dynamic-pricing-table.php b/woocommerce-dynamic-pricing-table.php index 44b07b1..a6e0ddb 100644 --- a/woocommerce-dynamic-pricing-table.php +++ b/woocommerce-dynamic-pricing-table.php @@ -3,7 +3,7 @@ * Plugin Name: WooCommerce Dynamic Pricing Table * Plugin URI: https://github.com/stuartduff/woocommerce-dynamic-pricing-table * Description: Displays a pricing discount table on WooCommerce products, a user role discount message and a simple category discount message when using the WooCommerce Dynamic Pricing plugin. - * Version: 1.0.4 + * Version: 1.0.5 * Author: Stuart Duff * Author URI: http://stuartduff.com * Requires at least: 4.6 @@ -138,8 +138,11 @@ private function log_plugin_version_number() { public function plugin_setup() { if ( class_exists( 'WC_Dynamic_Pricing' ) ) { add_action( 'woocommerce_before_add_to_cart_button', array( $this, 'output_dynamic_pricing_table' ) ); - add_action( 'wp', array( $this, 'output_dynamic_pricing_role_message' ) ); - add_action( 'wp', array( $this, 'output_dynamic_pricing_category_message' ) ); + + if ( ! is_admin() ) { + add_action( 'wp', array( $this, 'output_dynamic_pricing_role_message' ) ); + add_action( 'wp', array( $this, 'output_dynamic_pricing_category_message' ) ); + } } else { add_action( 'admin_notices', array( $this, 'install_wc_dynamic_pricing_notice' ) ); }