Wrap private link exclusion logic in `woocommerce_private_link` option check (#47690)

This commit is contained in:
Chi-Hsuan Huang 2024-05-22 19:15:37 +08:00 committed by GitHub
parent f55e25b009
commit ee6f69a14e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 8 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: update
Wrap LYS private link exclusion logic in an overall check

View File

@ -102,6 +102,8 @@ class ComingSoonRequestHandler {
return false; return false;
} }
// Check if the private link option is enabled.
if ( get_option( 'woocommerce_private_link' ) === 'yes' ) {
// Exclude users with a private link. // 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 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. // Persist the share link with a cookie for 90 days.
@ -111,6 +113,7 @@ class ComingSoonRequestHandler {
if ( isset( $_COOKIE['woo-share'] ) && get_option( 'woocommerce_share_key' ) === $_COOKIE['woo-share'] ) { if ( isset( $_COOKIE['woo-share'] ) && get_option( 'woocommerce_share_key' ) === $_COOKIE['woo-share'] ) {
return false; return false;
} }
}
return true; return true;
} }