BP_Core_Members_Switching::action_wp_meta()

Adds a ‘Switch back to {user}’ link to the Meta sidebar widget.

Description

Source

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

	public function action_wp_meta() {
		$old_user = self::get_old_user();

		if ( $old_user instanceof WP_User ) {
			$link = sprintf(
			/* Translators: 1: user display name; 2: username; */
				__( 'Switch back to %1$s (%2$s)', 'buddyboss' ),
				$old_user->display_name,
				$old_user->user_login
			);
			$url  = add_query_arg( array(
				'redirect_to' => urlencode( self::current_url() ),
			), self::switch_back_url( $old_user ) );
			echo '<li id="bp_member_switching_switch_on"><a href="' . esc_url( $url ) . '">' . esc_html( $link ) . '</a></li>';
		}
	}

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.