diff --git a/assets/css/frontend/widget-batch5.css b/assets/css/frontend/widget-batch5.css index 0d15fadd..f068cf75 100644 --- a/assets/css/frontend/widget-batch5.css +++ b/assets/css/frontend/widget-batch5.css @@ -512,3 +512,18 @@ color: var(--muted-2-color, #999); font-size: 12px; } + +.aksrt-user-card__oauth { + margin-top: 14px; + padding-top: 12px; + border-top: 1px dashed var(--color-line, #e5e7eb); +} +.aksrt-user-card__oauth .social-login-divider { + font-size: 12px; + color: var(--muted-2-color, #999); + margin-bottom: 8px; +} +.aksrt-user-card__oauth .social-login-item, +.aksrt-user-card__oauth a { + margin: 0 4px; +} diff --git a/src/AKSRT/Widgets/WidgetUserCard.php b/src/AKSRT/Widgets/WidgetUserCard.php index 5be7120f..c47afeea 100644 --- a/src/AKSRT/Widgets/WidgetUserCard.php +++ b/src/AKSRT/Widgets/WidgetUserCard.php @@ -137,6 +137,16 @@ class WidgetUserCard extends \WP_Widget { ? get_avatar_url(0, ['size' => 144, 'force_default' => true]) : includes_url('images/blank.gif'); + $oauth_html = ''; + if (class_exists('\AKSRT\Auth\OAuth')) { + $oauth = \AKSRT\Auth\OAuth::get_instance(); + if (method_exists($oauth, 'render_social_buttons')) { + $oauth_html = (string) $oauth->render_social_buttons(__('社交账号登录', 'aksrt')); + } elseif (method_exists($oauth, 'get_login_buttons')) { + $oauth_html = (string) $oauth->get_login_buttons(); + } + } + echo '
'; if ($show_cover) { echo '
'; @@ -147,9 +157,13 @@ class WidgetUserCard extends \WP_Widget { echo '
'; echo ''; if ($register) { - echo '' . esc_html__('注册', 'aksrt') . ''; + echo ''; } - echo '
'; + echo ''; + if ($oauth_html !== '') { + echo '
' . $oauth_html . '
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped + } + echo ''; } public function form($instance): void {