feat(widgets): user-card guest OAuth social login bar
Match zibll widget_ui_user guest shell with social provider buttons under login/register CTAs.
This commit is contained in:
@@ -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 '<div class="aksrt-user-card user-card zib-widget widget is-guest">';
|
||||
if ($show_cover) {
|
||||
echo '<div class="aksrt-user-card__cover user-cover graphic is-empty"></div>';
|
||||
@@ -147,9 +157,13 @@ class WidgetUserCard extends \WP_Widget {
|
||||
echo '<div class="aksrt-user-card__actions">';
|
||||
echo '<a class="aksrt-user-card__btn aksrt-user-card__btn--primary signin-loader" href="' . esc_url($login) . '">' . esc_html__('登录', 'aksrt') . '</a>';
|
||||
if ($register) {
|
||||
echo '<a class="aksrt-user-card__btn aksrt-user-card__btn--ghost" href="' . esc_url($register) . '">' . esc_html__('注册', 'aksrt') . '</a>';
|
||||
echo '<a class="aksrt-user-card__btn aksrt-user-card__btn--ghost signup-loader" href="' . esc_url($register) . '">' . esc_html__('注册', 'aksrt') . '</a>';
|
||||
}
|
||||
echo '</div></div></div>';
|
||||
echo '</div>';
|
||||
if ($oauth_html !== '') {
|
||||
echo '<div class="aksrt-user-card__oauth social_loginbar">' . $oauth_html . '</div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
echo '</div></div>';
|
||||
}
|
||||
|
||||
public function form($instance): void {
|
||||
|
||||
Reference in New Issue
Block a user