BP_Core_Members_Switching::get_old_user()

Validates the old user cookie and returns its user data.

Description

Return

(false|WP_User) False if there's no old user cookie or it's invalid, WP_User object if it's present and valid.

Source

File: bp-members/classes/class-bp-core-members-switching.php

	public static function get_old_user() {
		$cookie = bp_member_switching_get_olduser_cookie();
		if ( ! empty( $cookie ) ) {
			$old_user_id = wp_validate_auth_cookie( $cookie, 'logged_in' );

			if ( $old_user_id ) {
				return get_userdata( $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.