add_menu(
array(
'id' => 'abus_switch_to_user',
'title' => apply_filters( 'abus_switch_to_text', __( 'Switch to user', 'abus' ) ),
'href' => '#',
)
);
// Build the user search form markup
$form = '
';
// Add the admin bar sub menu item for the search form
$wp_admin_bar->add_menu(
array(
'id' => 'abus_user_search',
'parent' => 'abus_switch_to_user',
'title' => apply_filters( 'abus_form_output', $form ),
)
);
}
// Check if there is an old user stored i.e. this logged in user is through switching
if ( $user_switching->get_old_user() ) {
// Build the switch back url
$switchBackUrl = $user_switching->switch_back_url( $user_switching->get_old_user() );
/* we are logged in through switching so add admin bar menu to create the switch back link */
$wp_admin_bar->add_menu(
array(
'id' => 'switch_back',
'title' => apply_filters( 'abus_switch_back_text', __( 'Switch back', 'abus' ) ),
'href' => esc_url( add_query_arg( array( 'redirect_to' => abus_get_current_url() ), $switchBackUrl ) )
)
);
}
}
}