'gmail', 'text' => '', ], $atts, 'forwp_account_login' ); $provider = sanitize_key( (string) $atts['provider'] ); if ( ! ProviderSettings::is_enabled( $provider ) ) { return ''; } $labels = ProviderSettings::get_button_labels(); $text = ! empty( $atts['text'] ) ? sanitize_text_field( $atts['text'] ) : ( $labels[ $provider ] ?? __( 'Sign in', '4wp-account' ) ); if ( is_user_logged_in() ) { $current_user = wp_get_current_user(); return '
' . esc_html__( 'You are logged in as:', '4wp-account' ) . ' ' . esc_html( $current_user->display_name ) . '
'; } return SocialButtons::render_button( $provider, $text ); } /** * Render enabled auth buttons only. * * @param array $atts Shortcode attributes. * @return string */ public static function render_auth_buttons( $atts ) { $atts = shortcode_atts( [ 'providers' => 'auto', ], $atts, 'forwp_account_signin_buttons' ); if ( is_user_logged_in() ) { $current_user = wp_get_current_user(); return '
' . esc_html__( 'You are logged in as:', '4wp-account' ) . ' ' . esc_html( $current_user->display_name ) . '
'; } return self::render_buttons_markup( ProviderSettings::parse_provider_list( (string) $atts['providers'] ) ); } /** * @param string[] $provider_ids Enabled provider IDs. */ public static function render_buttons_markup( array $provider_ids ): string { return SocialButtons::render_list( $provider_ids ); } }