BP_Core_Members_Switching::switch_to_url( WP_User $user )

Returns the nonce-secured URL needed to switch to a given user ID.

Description

Parameters

$user

(Required) The user to be switched to.

Return

(string) The required URL.

Source

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

665
666
667
668
669
670
671
public static function switch_to_url( WP_User $user ) {
    return wp_nonce_url( add_query_arg( array(
        'action'  => 'switch_to_user',
        'user_id' => $user->ID,
        'nr'      => 1,
    ), wp_login_url() ), "switch_to_user_{$user->ID}" );
}

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.