80 lines
3.6 KiB
PHP
80 lines
3.6 KiB
PHP
<?php
|
|
/**
|
|
* User center profile header part.
|
|
*
|
|
* @package AKSRT
|
|
*/
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
$context = is_array($args['context'] ?? null) ? $args['context'] : [];
|
|
extract($context, EXTR_SKIP); // phpcs:ignore WordPress.PHP.DontExtract.extract_extract
|
|
?>
|
|
<!-- 头图 + 用户卡 -->
|
|
<div class="uc-header">
|
|
<div class="uc-header__cover">
|
|
<img id="aksrt-cover-img" class="uc-header__cover-img" src="<?php echo esc_url( $user_background_url ? $user_background_url : get_theme_file_uri( 'assets/img/person_background.png' ) ); ?>" alt="">
|
|
<div class="uc-header__cover-mask"></div>
|
|
<?php if ( $allow_bg_upload ) : ?>
|
|
<button type="button" class="uc-header__cover-upload" id="aksrt-upload-bg-btn" title="<?php esc_attr_e( '编辑背景图', 'aksrt' ); ?>">
|
|
<i class="fas fa-pen" aria-hidden="true"></i>
|
|
<span><?php esc_html_e( '编辑', 'aksrt' ); ?></span>
|
|
</button>
|
|
<input type="file" id="aksrt-bg-file-input" accept="image/jpeg,image/png,image/webp,image/gif" style="display:none">
|
|
<?php endif; ?>
|
|
</div>
|
|
<div class="uc-header__content">
|
|
<div class="uc-header__avatar">
|
|
<?php echo get_avatar( $user_id, 120, '', $target_user->display_name ); ?>
|
|
</div>
|
|
<div class="uc-header__info">
|
|
<h1 class="uc-header__name">
|
|
<?php echo esc_html( $target_user->display_name ); ?>
|
|
<?php
|
|
$vip_badge = function_exists('aksrt_render_vip_badge') ? aksrt_render_vip_badge($user_id) : '';
|
|
if ($vip_badge) echo $vip_badge; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
?>
|
|
</h1>
|
|
<?php if ( $target_user->description ) : ?>
|
|
<p class="uc-header__desc"><?php echo esc_html( $target_user->description ); ?></p>
|
|
<?php endif; ?>
|
|
<?php if ( ! empty( $profile_signals ) ) : ?>
|
|
<div class="aksrt-identity-chips">
|
|
<?php foreach ( $profile_signals as $signal ) : ?>
|
|
<span class="aksrt-identity-chip aksrt-identity-chip--<?php echo esc_attr( $signal['tone'] ); ?>">
|
|
<i class="fas fa-<?php echo esc_attr( $signal['icon'] ); ?>" aria-hidden="true"></i>
|
|
<span><?php echo esc_html( $signal['label'] ); ?></span>
|
|
</span>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
<div class="uc-header__meta">
|
|
<span class="uc-header__meta-item" title="<?php esc_attr_e( '用户名', 'aksrt' ); ?>">
|
|
<i class="fas fa-user" aria-hidden="true"></i> <?php echo esc_html( $target_user->user_login ); ?>
|
|
</span>
|
|
<?php if ( $target_user->user_email ) : ?>
|
|
<span class="uc-header__meta-item" title="<?php esc_attr_e( '邮箱', 'aksrt' ); ?>">
|
|
<i class="fas fa-envelope" aria-hidden="true"></i> <?php echo esc_html( $target_user->user_email ); ?>
|
|
</span>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
<div class="uc-header__actions">
|
|
<a href="<?php echo esc_url( $messages_url ); ?>" class="btn-ghost btn-sm">
|
|
<i class="fas fa-bell" aria-hidden="true"></i> <?php esc_html_e( '消息通知', 'aksrt' ); ?>
|
|
<?php if ( $notification_unread_count > 0 ) : ?>
|
|
<span class="uc-header__action-badge"><?php echo esc_html( (string) $notification_unread_count ); ?></span>
|
|
<?php endif; ?>
|
|
</a>
|
|
<?php if ( $show_avatar_edit ) : ?>
|
|
<a href="<?php echo esc_url( $avatar_settings_url ); ?>" class="btn-ghost btn-sm">
|
|
<i class="fas fa-camera" aria-hidden="true"></i> <?php esc_html_e( '更换头像', 'aksrt' ); ?>
|
|
</a>
|
|
<?php endif; ?>
|
|
<a href="<?php echo esc_url( aksrt_get_user_home_url() ); ?>" class="btn-ghost btn-sm">
|
|
<i class="fas fa-map-marker-alt" aria-hidden="true"></i> <?php esc_html_e( '我的主页', 'aksrt' ); ?>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|