Prevent coupon move notice for new installs. (https://github.com/woocommerce/woocommerce-admin/pull/7995)
* Prevent notice if legacy coupon menu is disabled * Disable legacy menu for new install * Add changelog entry * Add PR number to changelog
This commit is contained in:
parent
6c2fbce0c0
commit
3fb028931e
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: Fix
|
||||||
|
|
||||||
|
Prevent coupon move notice for new installs. #7995
|
|
@ -33,6 +33,7 @@ class CouponPageMoved {
|
||||||
|
|
||||||
add_action( 'admin_init', [ $this, 'possibly_add_note' ] );
|
add_action( 'admin_init', [ $this, 'possibly_add_note' ] );
|
||||||
add_action( 'admin_init', [ $this, 'redirect_to_coupons' ] );
|
add_action( 'admin_init', [ $this, 'redirect_to_coupons' ] );
|
||||||
|
add_action( 'woocommerce_admin_newly_installed', [ $this, 'disable_legacy_menu_for_new_install' ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,6 +46,11 @@ class CouponPageMoved {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't add the notice if the legacy coupon menu is already disabled.
|
||||||
|
if ( ! self::should_display_legacy_menu() ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Don't add the notice if it's been hidden by the user before.
|
// Don't add the notice if it's been hidden by the user before.
|
||||||
if ( self::has_dismissed_note() ) {
|
if ( self::has_dismissed_note() ) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -55,11 +61,6 @@ class CouponPageMoved {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If new navigation feature is enabled.
|
|
||||||
if ( Features::is_enabled( 'navigation' ) ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return isset( $_GET[ self::$query_key ] ) && (bool) $_GET[ self::$query_key ]; // phpcs:ignore WordPress.Security.NonceVerification
|
return isset( $_GET[ self::$query_key ] ) && (bool) $_GET[ self::$query_key ]; // phpcs:ignore WordPress.Security.NonceVerification
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,4 +149,11 @@ class CouponPageMoved {
|
||||||
wp_safe_redirect( self::get_management_url( 'coupons' ) );
|
wp_safe_redirect( self::get_management_url( 'coupons' ) );
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable legacy coupon menu when installing for the first time.
|
||||||
|
*/
|
||||||
|
public function disable_legacy_menu_for_new_install() {
|
||||||
|
$this->display_legacy_menu( false );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue