BP_Core_Members_Switching::filter_login_message( string $message )
Adds a ‘Switch back to {user}’ link to the WordPress login screen.
Description
Parameters
- $message
-
(Required) The login screen message.
Return
(string) The login screen message.
Source
File: bp-members/classes/class-bp-core-members-switching.php
public function filter_login_message( $message ) { $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 = self::switch_back_url( $old_user ); if ( ! empty( $_REQUEST['interim-login'] ) ) { $url = add_query_arg( array( 'interim-login' => '1', ), $url ); } elseif ( ! empty( $_REQUEST['redirect_to'] ) ) { $url = add_query_arg( array( 'redirect_to' => urlencode( wp_unslash( $_REQUEST['redirect_to'] ) ), // WPCS: sanitization ok ), $url ); } $message .= '<p class="message" id="bp_member_switching_switch_on">'; $message .= '<span class="dashicons dashicons-admin-users" style="color:#56c234" aria-hidden="true"></span> '; $message .= '<a href="' . esc_url( $url ) . '" onclick="window.location.href=\'' . esc_url( $url ) . '\';return false;">' . esc_html( $link ) . '</a>'; $message .= '</p>'; } return $message; }
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.