Skip to content

Commit

Permalink
Revert "Fix/PRESS11-30 capabilities being checked on every pageload"
Browse files Browse the repository at this point in the history
  • Loading branch information
officiallygod authored Oct 28, 2024
1 parent 4a51729 commit 1a6a319
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 20 deletions.
19 changes: 8 additions & 11 deletions bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@

use function NewfoldLabs\WP\ModuleLoader\register;

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
return;
}

/**
* Register Onboarding with Newfold Module Loader
*
Expand Down Expand Up @@ -70,9 +65,11 @@ function nfd_wp_module_onboarding_register() {
/**
* Tap WordPress Hooks to Instantiate Module Loader
*/
add_action(
'plugins_loaded',
'nfd_wp_module_onboarding_register'
);
// Handle Module Disable if Non-Ecommerce
ModuleController::init();
if ( is_callable( 'add_action' ) ) {
add_action(
'plugins_loaded',
'nfd_wp_module_onboarding_register'
);
// Handle Module Disable if Non-Ecommerce
ModuleController::init();
}
12 changes: 3 additions & 9 deletions includes/ModuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ class ModuleController {

/**
* Initialize the Module Controller functionality.
*
* @used-by wp-module-onboarding/bootstrap.php
*/
public static function init() {
// Enable/Disable the module after_setup_theme.
Expand All @@ -28,17 +26,13 @@ public static function init() {

/**
* Enable/Disable Onboarding based on certain checks.
*
* @hooked after_setup_theme
*/
public static function module_switcher() {
$module_name = 'onboarding';
// Set brand context for the module.
$current_brand = Brands::set_current_brand( container() );

$enable_onboarding =
current_user_can( 'manage_options' )
&& self::verify_onboarding_criteria(
Brands::set_current_brand( container() )
);
$enable_onboarding = self::verify_onboarding_criteria( $current_brand );

// Check if he is a Non-Ecommerce Customer and Disable Redirect and Module
if ( ! $enable_onboarding ) {
Expand Down

0 comments on commit 1a6a319

Please sign in to comment.