From 147f4dd2c8948d7ffcc3e30f3a81a7bd34f651c2 Mon Sep 17 00:00:00 2001 From: Johan Holst Nielsen Date: Tue, 24 Sep 2019 20:19:15 +0200 Subject: [PATCH] Fix Cookiebot disabled in WP admin feature --- addons/controller/plugin-controller.php | 4 ++++ addons/cookiebot-addons-init.php | 1 - cookiebot.php | 6 ++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/addons/controller/plugin-controller.php b/addons/controller/plugin-controller.php index 20e28d25..4efc6745 100644 --- a/addons/controller/plugin-controller.php +++ b/addons/controller/plugin-controller.php @@ -60,6 +60,10 @@ public function load_active_addons() { return; } + if( \Cookiebot_WP::cookiebot_disabled_in_admin() === true && is_admin() ) { + return; + } + /** * Check plugins one by one and load configuration if it is active * diff --git a/addons/cookiebot-addons-init.php b/addons/cookiebot-addons-init.php index 15d31f0d..8046c634 100644 --- a/addons/cookiebot-addons-init.php +++ b/addons/cookiebot-addons-init.php @@ -117,7 +117,6 @@ public function __construct() { new Plugin_Controller( $this->container->get( 'Settings_Service_Interface' ) ), 'load_active_addons', ) ); - /** * Load settings config * diff --git a/cookiebot.php b/cookiebot.php index 6bc73caf..0a52beab 100644 --- a/cookiebot.php +++ b/cookiebot.php @@ -114,9 +114,7 @@ function cookiebot_init() { //Make sure we got a PHP version that works if(version_compare(PHP_VERSION, '5.4.0', '>=')) { define('COOKIEBOT_URL', plugin_dir_url( __FILE__ )); - if(!is_admin() || !$this->cookiebot_disabled_in_admin()) { - include_once( dirname( __FILE__ ) . '/addons/cookiebot-addons-init.php' ); - } + include_once( dirname( __FILE__ ) . '/addons/cookiebot-addons-init.php' ); } else { define('COOKIEBOT_ADDONS_UNSUPPORTED_PHPVERSION',true); @@ -696,7 +694,7 @@ function settings_page() { ?>

'._('Network setting applied. Please contact website administrator to change this setting.').'
'; } ?> - +