Skip to content

Commit

Permalink
Tweak: Skip onboarding wizard if not on site admin [TMZ-320] (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
nuritsha authored Jan 21, 2025
1 parent 6841b9d commit ac1887a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 16 deletions.
8 changes: 4 additions & 4 deletions modules/admin/classes/ajax/setup-wizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@

class Setup_Wizard {

public function __construct() {
add_action( 'wp_ajax_helloplus_setup_wizard', [ $this, 'ajax_setup_wizard' ] );
}

public function ajax_setup_wizard() {
check_ajax_referer( 'updates', 'nonce' );

Expand Down Expand Up @@ -44,4 +40,8 @@ public function ajax_setup_wizard() {
wp_send_json_error( [ 'message' => __( 'Invalid step.', 'hello-plus' ) ] );
}
}

public function __construct() {
add_action( 'wp_ajax_helloplus_setup_wizard', [ $this, 'ajax_setup_wizard' ] );
}
}
4 changes: 4 additions & 0 deletions modules/admin/components/admin-menu-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ public function redirect_on_first_activation() {
return;
}

if ( ! is_admin() ) {
return;
}

delete_transient( self::SETUP_WIZARD_TRANSIENT_NAME );

if ( Utils::are_we_on_elementor_domains() ) {
Expand Down
12 changes: 6 additions & 6 deletions modules/admin/components/api-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ class Api_Controller {

protected $ajax_classes = [];

public function __construct() {
$this->endpoints['onboarding-settings'] = new Onboarding_Settings();

$this->ajax_classes['setup-wizard'] = new Setup_Wizard();
}

public function get_endpoint( string $endpoint ) {
if ( ! isset( $this->endpoints[ $endpoint ] ) ) {
throw new \Exception( esc_html__( 'Endpoint not found', 'hello-plus' ) );
}

return $this->endpoints[ $endpoint ];
}

public function __construct() {
$this->endpoints['onboarding-settings'] = new Onboarding_Settings();

$this->ajax_classes['setup-wizard'] = new Setup_Wizard();
}
}
9 changes: 4 additions & 5 deletions modules/admin/components/scripts-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
}

class Scripts_Controller {

public function __construct() {
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_hello_plus_onboarding_scripts' ] );
}

public function enqueue_hello_plus_onboarding_scripts() {
$screen = get_current_screen();

Expand Down Expand Up @@ -44,4 +39,8 @@ public function enqueue_hello_plus_onboarding_scripts() {

wp_set_script_translations( $handle, 'hello-plus' );
}

public function __construct() {
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_hello_plus_onboarding_scripts' ] );
}
}
1 change: 0 additions & 1 deletion plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
}

use HelloPlus\Includes\Module_Base;
use HelloPlus\Includes\Utils;

/**
* Theme's main class,
Expand Down

0 comments on commit ac1887a

Please sign in to comment.