Add exclusion for users with private link (#46465)
* Add exclusion for users with private link * Remove unused private function * Fix lint issues * Add changelog * Update sanitization method sanitize_key converts to lowercase * Fix lint issue
This commit is contained in:
parent
5e8644d7a5
commit
6486c26d76
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: add
|
||||
|
||||
Add coming soon exclusion for users with a private link.
|
|
@ -54,6 +54,16 @@ class ComingSoonRequestHandler {
|
|||
return $wp;
|
||||
}
|
||||
|
||||
// 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 $wp;
|
||||
}
|
||||
if ( isset( $_COOKIE['woo-share'] ) && get_option( 'woocommerce_share_key' ) === $_COOKIE['woo-share'] ) {
|
||||
return $wp;
|
||||
}
|
||||
|
||||
// A coming soon page needs to be displayed. Don't cache this response.
|
||||
nocache_headers();
|
||||
|
||||
|
|
Loading…
Reference in New Issue