From 0c29992e722f056cd7636b5d88fe8256be6ef565 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sun, 10 Sep 2017 21:08:19 +0000 Subject: [PATCH] Login and Registration: Pass the user session token to the `set_auth_cookie` and `set_logged_in_cookie` filters. This also adds some missing `@since` parameters for other uses of the token so that developers know when the token was first made available to various filters. Fixes #41849 git-svn-id: https://develop.svn.wordpress.org/trunk@41365 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/pluggable.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/pluggable.php b/src/wp-includes/pluggable.php index 882660ae3a..c4e271518b 100644 --- a/src/wp-includes/pluggable.php +++ b/src/wp-includes/pluggable.php @@ -694,6 +694,7 @@ if ( !function_exists('wp_generate_auth_cookie') ) : * Generate authentication cookie contents. * * @since 2.5.0 + * @since 4.0.0 The `$token` parameter was added. * * @param int $user_id User ID * @param int $expiration The time the cookie expires as a UNIX timestamp. @@ -726,6 +727,7 @@ function wp_generate_auth_cookie( $user_id, $expiration, $scheme = 'auth', $toke * Filters the authentication cookie. * * @since 2.5.0 + * @since 4.0.0 The `$token` parameter was added. * * @param string $cookie Authentication cookie. * @param int $user_id User ID. @@ -874,6 +876,7 @@ function wp_set_auth_cookie( $user_id, $remember = false, $secure = '', $token = * Fires immediately before the authentication cookie is set. * * @since 2.5.0 + * @since 4.9.0 The `$token` parameter was added. * * @param string $auth_cookie Authentication cookie. * @param int $expire The time the login grace period expires as a UNIX timestamp. @@ -882,13 +885,15 @@ function wp_set_auth_cookie( $user_id, $remember = false, $secure = '', $token = * Default is 14 days from now. * @param int $user_id User ID. * @param string $scheme Authentication scheme. Values include 'auth', 'secure_auth', or 'logged_in'. + * @param string $token User's session token to use for this cookie. */ - do_action( 'set_auth_cookie', $auth_cookie, $expire, $expiration, $user_id, $scheme ); + do_action( 'set_auth_cookie', $auth_cookie, $expire, $expiration, $user_id, $scheme, $token ); /** * Fires immediately before the logged-in authentication cookie is set. * * @since 2.6.0 + * @since 4.9.0 The `$token` parameter was added. * * @param string $logged_in_cookie The logged-in cookie. * @param int $expire The time the login grace period expires as a UNIX timestamp. @@ -897,8 +902,9 @@ function wp_set_auth_cookie( $user_id, $remember = false, $secure = '', $token = * Default is 14 days from now. * @param int $user_id User ID. * @param string $scheme Authentication scheme. Default 'logged_in'. + * @param string $token User's session token to use for this cookie. */ - do_action( 'set_logged_in_cookie', $logged_in_cookie, $expire, $expiration, $user_id, 'logged_in' ); + do_action( 'set_logged_in_cookie', $logged_in_cookie, $expire, $expiration, $user_id, 'logged_in', $token ); /** * Allows preventing auth cookies from actually being sent to the client.