From 67abe8cfb3e5f76ab56e08077190f06918b14add Mon Sep 17 00:00:00 2001 From: audrasjb Date: Tue, 31 Jan 2023 08:46:13 +0000 Subject: [PATCH] Users: Add context to the `send_auth_cookies` filter. This changeset adds `$user_id`, `$expire`, `$expiration` and `$token` parameters to provide context to `send_auth_cookies` hook, which allows the filter to skip sending auth cookies. Props dd32, mukesh27, costdev, peterwilsoncc, audrasjb. Fixes #56971. See #39367. Built from https://develop.svn.wordpress.org/trunk@55164 git-svn-id: http://core.svn.wordpress.org/trunk@54697 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/pluggable.php | 13 +++++++++++-- wp-includes/version.php | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php index c4b5bf4a75..24a760c07e 100644 --- a/wp-includes/pluggable.php +++ b/wp-includes/pluggable.php @@ -1072,8 +1072,17 @@ if ( ! function_exists( 'wp_set_auth_cookie' ) ) : * @since 4.7.4 * * @param bool $send Whether to send auth cookies to the client. + * @since 6.2.0 The `$user_id`, `$expire`, `$expiration` and, `$token` parameters were added. + * + * @param bool $send Whether to send auth cookies to the client. + * @param int $user_id User ID. Zero when clearing cookies. + * @param int $expire The time the login grace period expires as a UNIX timestamp. + * Zero when clearing cookies. + * @param int $expiration The time when the logged-in authentication cookie expires as a UNIX timestamp. + * Default is 14 days from now. Zero when clearing cookies. + * @param string $token User's session token to use for this cookie. Empty string when clearing cookies. */ - if ( ! apply_filters( 'send_auth_cookies', true ) ) { + if ( ! apply_filters( 'send_auth_cookies', true, $user_id, $expire, $expiration, $token ) ) { return; } @@ -1101,7 +1110,7 @@ if ( ! function_exists( 'wp_clear_auth_cookie' ) ) : do_action( 'clear_auth_cookie' ); /** This filter is documented in wp-includes/pluggable.php */ - if ( ! apply_filters( 'send_auth_cookies', true ) ) { + if ( ! apply_filters( 'send_auth_cookies', true, 0, 0, 0, '' ) ) { return; } diff --git a/wp-includes/version.php b/wp-includes/version.php index a258591791..d9f5a0a1ca 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.2-alpha-55163'; +$wp_version = '6.2-alpha-55164'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.