From 4bb46aa01abeefc0e378ccd12dc2a5eec2f3eac4 Mon Sep 17 00:00:00 2001 From: German Lena Date: Thu, 14 May 2015 12:23:10 -0300 Subject: [PATCH] fix to wait that all the plugins are loaded --- WP_Auth0.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/WP_Auth0.php b/WP_Auth0.php index 85651d26..d9372216 100644 --- a/WP_Auth0.php +++ b/WP_Auth0.php @@ -67,10 +67,13 @@ public static function init(){ WP_Auth0_ErrorLog::init(); WP_Auth0_Configure_JWTAUTH::init(); - self::checkJWTAuth(); + add_action('plugins_loaded', array( __CLASS__, 'checkJWTAuth' )); } public static function isJWTAuthEnabled() { + if (!function_exists('is_plugin_active')) { + require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); + } return is_plugin_active('wp-jwt-auth/JWT_AUTH.php'); } @@ -86,7 +89,7 @@ public static function isJWTConfigured() { } - protected static function checkJWTAuth() { + public static function checkJWTAuth() { if ( isset($_REQUEST['page']) && $_REQUEST['page'] == 'wpa0-jwt-auth' ) return; if( self::isJWTAuthEnabled() && !self::isJWTConfigured() ) {