Wrap private link exclusion logic in `woocommerce_private_link` option check (#47690)
This commit is contained in:
parent
f55e25b009
commit
ee6f69a14e
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: update
|
||||
|
||||
Wrap LYS private link exclusion logic in an overall check
|
|
@ -102,14 +102,17 @@ class ComingSoonRequestHandler {
|
|||
return false;
|
||||
}
|
||||
|
||||
// Exclude users with a private link.
|
||||
if ( isset( $_GET['woo-share'] ) && get_option( 'woocommerce_share_key' ) === $_GET['woo-share'] ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
// Persist the share link with a cookie for 90 days.
|
||||
setcookie( 'woo-share', sanitize_text_field( wp_unslash( $_GET['woo-share'] ) ), time() + 60 * 60 * 24 * 90, '/' ); //phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
return false;
|
||||
}
|
||||
if ( isset( $_COOKIE['woo-share'] ) && get_option( 'woocommerce_share_key' ) === $_COOKIE['woo-share'] ) {
|
||||
return false;
|
||||
// Check if the private link option is enabled.
|
||||
if ( get_option( 'woocommerce_private_link' ) === 'yes' ) {
|
||||
// Exclude users with a private link.
|
||||
if ( isset( $_GET['woo-share'] ) && get_option( 'woocommerce_share_key' ) === $_GET['woo-share'] ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
// Persist the share link with a cookie for 90 days.
|
||||
setcookie( 'woo-share', sanitize_text_field( wp_unslash( $_GET['woo-share'] ) ), time() + 60 * 60 * 24 * 90, '/' ); //phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
return false;
|
||||
}
|
||||
if ( isset( $_COOKIE['woo-share'] ) && get_option( 'woocommerce_share_key' ) === $_COOKIE['woo-share'] ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue