BP_Core_Members_Switching::authenticate_old_user( WP_User $user )
Authenticates an old user by verifying the latest entry in the auth cookie.
Description
Parameters
- $user
-
(Required) A WP_User object (usually from the logged_in cookie).
Return
(bool) Whether verification with the auth cookie passed.
Source
File: bp-members/classes/class-bp-core-members-switching.php
public static function authenticate_old_user( WP_User $user ) {
$cookie = bp_member_switching_get_auth_cookie();
if ( ! empty( $cookie ) ) {
if ( self::secure_auth_cookie() ) {
$scheme = 'secure_auth';
} else {
$scheme = 'auth';
}
$old_user_id = wp_validate_auth_cookie( end( $cookie ), $scheme );
if ( $old_user_id ) {
return ( $user->ID === $old_user_id );
}
}
return false;
}
Changelog
| Version | Description |
|---|---|
| BuddyBoss 1.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.