Moved to a new function
This commit is contained in:
parent
b2c8113525
commit
65b024a96d
|
@ -75,7 +75,7 @@ class WC_Session_Handler extends WC_Session {
|
||||||
add_action( 'wp_logout', array( $this, 'destroy_session' ) );
|
add_action( 'wp_logout', array( $this, 'destroy_session' ) );
|
||||||
|
|
||||||
if ( ! is_user_logged_in() ) {
|
if ( ! is_user_logged_in() ) {
|
||||||
add_filter( 'nonce_user_logged_out', array( $this, 'nonce_user_logged_out' ), 10, 2 );
|
add_filter( 'nonce_user_logged_out', array( $this, 'maybe_update_nonce_user_logged_out' ), 10, 2 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,11 +288,24 @@ class WC_Session_Handler extends WC_Session {
|
||||||
/**
|
/**
|
||||||
* When a user is logged out, ensure they have a unique nonce by using the customer/session ID.
|
* When a user is logged out, ensure they have a unique nonce by using the customer/session ID.
|
||||||
*
|
*
|
||||||
|
* @deprecated 5.3.0
|
||||||
|
* @param int $uid User ID.
|
||||||
|
* @return int|string
|
||||||
|
*/
|
||||||
|
public function nonce_user_logged_out( $uid ) {
|
||||||
|
return $this->has_session() && $this->_customer_id ? $this->_customer_id : $uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When a user is logged out, ensure they have a unique nonce to manage cart and more using the customer/session ID.
|
||||||
|
* This filter runs everything `wp_verify_nonce()` and `wp_create_nonce()` gets called.
|
||||||
|
*
|
||||||
|
* @since 5.3.0
|
||||||
* @param int $uid User ID.
|
* @param int $uid User ID.
|
||||||
* @param string $action The nonce action.
|
* @param string $action The nonce action.
|
||||||
* @return int|string
|
* @return int|string
|
||||||
*/
|
*/
|
||||||
public function nonce_user_logged_out( $uid, $action ) {
|
public function maybe_update_nonce_user_logged_out( $uid, $action ) {
|
||||||
if ( Automattic\WooCommerce\Utilities\StringUtil::starts_with( $action, 'woocommerce' ) ) {
|
if ( Automattic\WooCommerce\Utilities\StringUtil::starts_with( $action, 'woocommerce' ) ) {
|
||||||
return $this->has_session() && $this->_customer_id ? $this->_customer_id : $uid;
|
return $this->has_session() && $this->_customer_id ? $this->_customer_id : $uid;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue