Skip to content

Commit

Permalink
Redirect to plugin page on activation
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Apr 4, 2024
1 parent 1439c10 commit f73f33b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
4 changes: 4 additions & 0 deletions assets/css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@
\*------------------------------------*/
.prpl-widget-wrapper.prpl-welcome {
margin-bottom: var(--prpl-gap);
padding: calc(var(--prpl-gap) * 1.5);
background: var(--prpl-background-purple);
border: none;
box-shadow: 0 0 10px var(--prpl-color-gray-2)
}

/*------------------------------------*\
Expand Down
6 changes: 3 additions & 3 deletions includes/class-base.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ public function init() {
new Badge_Maintenance_Maniac();
new Badge_Super_Site_Specialist();

// REST API.
new Rest_API();

if ( ! Settings::get( 'license_key' ) ) {
new Onboard();
}
// Onboarding.
new Onboard();
}

/**
Expand Down
24 changes: 24 additions & 0 deletions includes/class-onboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,33 @@ class Onboard {
* Constructor.
*/
public function __construct() {
if ( Settings::get( 'license_key' ) ) {
return;
}

// Redirect on plugin activation.
\add_action( 'activated_plugin', [ $this, 'on_activate_plugin' ], 10 );

// Handle saving data from the onboarding form response.
\add_action( 'wp_ajax_progress_planner_save_onboard_data', [ $this, 'save_onboard_response' ] );
}

/**
* On plugin activation.
*
* @param string $plugin The plugin file.
*
* @return void
*/
public function on_activate_plugin( $plugin ) {
if ( 'progress-planner/progress-planner.php' !== $plugin ) {
return;
}

\wp_safe_redirect( admin_url( 'admin.php?page=progress-planner' ) );
exit;
}

/**
* The onboarding form.
*
Expand Down

0 comments on commit f73f33b

Please sign in to comment.