bp_member_switching_get_auth_cookie()
Gets the value of the auth cookie containing the list of originating users.
Description
Return
(string[]) Array of originating user authentication cookie values. Empty array if there are none.
Source
File: bp-members/bp-members-functions.php
function bp_member_switching_get_auth_cookie() {
if ( BP_Core_Members_Switching::secure_auth_cookie() ) {
$auth_cookie_name = BP_MEMBER_SWITCHING_SECURE_COOKIE;
} else {
$auth_cookie_name = BP_MEMBER_SWITCHING_COOKIE;
}
if ( isset( $_COOKIE[ $auth_cookie_name ] ) && is_string( $_COOKIE[ $auth_cookie_name ] ) ) {
$cookie = json_decode( wp_unslash( $_COOKIE[ $auth_cookie_name ] ) ); // WPCS: sanitization ok
}
if ( ! isset( $cookie ) || ! is_array( $cookie ) ) {
$cookie = array();
}
return $cookie;
}
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.