Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Fix/PRESS11-30 capabilities being checked on every pageload" #629

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading