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

355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
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

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.