user-switching.php
public function action_bbpress_button() {
		$user = get_userdata( bbp_get_user_id() );

		if ( ! $user ) {
			return;
		}

		$link = self::maybe_switch_url( $user );

		if ( ! $link ) {
			return;
		}

		$link = add_query_arg( array(
			'redirect_to' => urlencode( bbp_get_user_profile_url( $user->ID ) ),
		), $link );

		?>
		<ul id="user_switching_switch_to">
			<li><a href="<?php echo esc_url( $link ); ?>"><?php esc_html_e( 'Switch&nbsp;To', 'user-switching' ); ?></a></li>
		</ul>
		<?php
	}
public function action_bbpress_button() {
		$user = get_userdata( bbp_get_user_id() );

		if ( ! $user ) {
			return;
		}

		$link = self::maybe_switch_url( $user );

		if ( ! $link ) {
			return;
		}

		$link = add_query_arg( array(
			'redirect_to' => urlencode( bbp_get_user_profile_url( $user->ID ) ),
		), $link );

		?>
		<ul id="user_switching_switch_to">
			<li><a href="<?php echo esc_url( $link ); ?>"><?php esc_html_e( 'Switch&nbsp;To', 'user-switching' ); ?></a></li>
		</ul>
		<?php
	}
public function action_bbpress_button ( ) { $ user = get_userdata ( bbp_get_user_id ( ) ) ; if ( ! $ user ) { return ; } $ link = self :: maybe_switch_url ( $ user ) ; if ( ! $ link ) { return ; } $ link = add_query_arg ( array ( 'redirect_to' => urlencode ( bbp_get_user_profile_url ( $ user -> ID ) ) , ) , $ link ) ; ?>
		<ul id="user_switching_switch_to">
			<li><a href="<?php echo esc_url ( $ link ) ; ?>"><?php esc_html_e ( 'Switch&nbsp;To' , 'user-switching' ) ; ?></a></li>
		</ul>
		<?php }
Adds a 'Switch To' link to each member's profile page in bbPress.
Adds a Switch To link to each member s profile page in bbPress .