Redirect old onboarding wizard to profiler when active (https://github.com/woocommerce/woocommerce-admin/pull/3593)

This commit is contained in:
Joshua T Flowers 2020-01-21 20:05:10 +08:00 committed by GitHub
parent 127ede4fd7
commit b0b79e8968
1 changed files with 13 additions and 0 deletions

View File

@ -101,10 +101,23 @@ class Onboarding {
add_action( 'current_screen', array( $this, 'reset_task_list' ) );
add_action( 'current_screen', array( $this, 'calypso_tests' ) );
add_action( 'current_screen', array( $this, 'redirect_wccom_install' ) );
add_action( 'current_screen', array( $this, 'redirect_old_onboarding' ) );
add_filter( 'woocommerce_admin_is_loading', array( $this, 'is_loading' ) );
add_filter( 'woocommerce_show_admin_notice', array( $this, 'remove_install_notice' ), 10, 2 );
}
/**
* Redirect the old onboarding wizard to the profiler.
*/
public static function redirect_old_onboarding() {
$current_page = isset( $_GET['page'] ) ? wc_clean( wp_unslash( $_GET['page'] ) ) : false; // phpcs:ignore csrf okay.
if ( 'wc-setup' === $current_page ) {
delete_transient( '_wc_activation_redirect' );
wp_safe_redirect( wc_admin_url() );
}
}
/**
* Returns true if the profiler should be displayed (not completed).
*