用户中心 posts/sidebar/form 渲染器整包拆分并清理标记
This commit is contained in:
1 parent
81d5647205
commit
57ccdb60c4
13 files changed
+450
-380
No files matched your search
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* User center profile form part.
|
||||
* User center profile form part (orchestrator).
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
@@ -10,57 +10,32 @@ defined('ABSPATH') || exit;
|
||||
$context = is_array($args['context'] ?? null) ? $args['context'] : [];
|
||||
extract($context, EXTR_SKIP); // phpcs:ignore WordPress.PHP.DontExtract.extract_extract
|
||||
?>
|
||||
<!-- ==================== 个人信息(可编辑) ==================== -->
|
||||
<form class="profile-form" id="profile-form" method="post">
|
||||
<?php wp_nonce_field( 'aksrt_profile_save', '_profile_nonce' ); ?>
|
||||
<input type="hidden" name="action" value="aksrt_save_profile">
|
||||
<input type="hidden" name="user_id" value="<?php echo (int) $user_id; ?>">
|
||||
<form class="profile-form" id="profile-form" method="post">
|
||||
<?php wp_nonce_field('aksrt_profile_save', '_profile_nonce'); ?>
|
||||
<input type="hidden" name="action" value="aksrt_save_profile">
|
||||
<input type="hidden" name="user_id" value="<?php echo (int) $user_id; ?>">
|
||||
|
||||
<!-- 昵称 -->
|
||||
<div class="widget-card">
|
||||
<h3 class="widget-title"><?php esc_html_e( '昵称', 'aksrt' ); ?></h3>
|
||||
<input type="text" name="nickname" id="profile-nickname"
|
||||
value="<?php echo esc_attr( $target_user->display_name ); ?>"
|
||||
class="profile-input" maxlength="50" required>
|
||||
<p class="profile-hint"><?php esc_html_e( '修改后会同步更新个人主页地址', 'aksrt' ); ?></p>
|
||||
</div>
|
||||
<div class="widget-card">
|
||||
<h3 class="widget-title"><?php esc_html_e('昵称', 'aksrt'); ?></h3>
|
||||
<input type="text" name="nickname" id="profile-nickname"
|
||||
value="<?php echo esc_attr($target_user->display_name); ?>"
|
||||
class="profile-input" maxlength="50" required>
|
||||
<p class="profile-hint"><?php esc_html_e('修改后会同步更新个人主页地址', 'aksrt'); ?></p>
|
||||
</div>
|
||||
|
||||
<!-- 个人简介 -->
|
||||
<div class="widget-card">
|
||||
<h3 class="widget-title"><?php esc_html_e( '个人简介', 'aksrt' ); ?></h3>
|
||||
<textarea name="description" id="profile-bio" class="profile-input profile-textarea"
|
||||
rows="4" maxlength="500" placeholder="<?php esc_attr_e( '介绍一下自己…', 'aksrt' ); ?>"><?php echo esc_textarea( $target_user->description ); ?></textarea>
|
||||
<p class="profile-hint"><?php esc_html_e( '显示在你的公开用户主页上,最多 500 字', 'aksrt' ); ?></p>
|
||||
</div>
|
||||
<div class="widget-card">
|
||||
<h3 class="widget-title"><?php esc_html_e('个人简介', 'aksrt'); ?></h3>
|
||||
<textarea name="description" id="profile-bio" class="profile-input profile-textarea"
|
||||
rows="4" maxlength="500" placeholder="<?php esc_attr_e('介绍一下自己…', 'aksrt'); ?>"><?php echo esc_textarea($target_user->description); ?></textarea>
|
||||
<p class="profile-hint"><?php esc_html_e('显示在你的公开用户主页上,最多 500 字', 'aksrt'); ?></p>
|
||||
</div>
|
||||
|
||||
<?php if ( ! empty( $user_center_settings['social_links'] ) ) : ?>
|
||||
<!-- 联系方式 -->
|
||||
<div class="widget-card">
|
||||
<h3 class="widget-title"><?php esc_html_e( '联系方式', 'aksrt' ); ?></h3>
|
||||
<p class="profile-hint profile-hint--top"><?php esc_html_e( '添加你的社交链接,显示在公开用户主页', 'aksrt' ); ?></p>
|
||||
<div id="contacts-list">
|
||||
<?php foreach ( $user_contacts as $i => $contact ) : ?>
|
||||
<div class="contact-row" data-index="<?php echo (int) $i; ?>">
|
||||
<select name="contacts[<?php echo (int) $i; ?>][icon]" class="profile-input contact-icon">
|
||||
<?php echo aksrt_contact_icon_options( $contact['icon'] ?? '' ); ?>
|
||||
</select>
|
||||
<input type="hidden" name="contacts[<?php echo (int) $i; ?>][name]" value="">
|
||||
<input type="url" name="contacts[<?php echo (int) $i; ?>][url]"
|
||||
value="<?php echo esc_url( $contact['url'] ?? '' ); ?>"
|
||||
class="profile-input contact-url" placeholder="<?php esc_attr_e( '链接 URL', 'aksrt' ); ?>">
|
||||
<button type="button" class="contact-remove" onclick="this.parentElement.remove()" title="<?php esc_attr_e( '删除', 'aksrt' ); ?>">×</button>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<button type="button" class="btn-ghost btn-sm profile-add-contact" id="add-contact-btn">+ <?php esc_html_e( '添加联系方式', 'aksrt' ); ?></button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php require __DIR__ . '/form-contacts.php'; ?>
|
||||
|
||||
<!-- 保存按钮 -->
|
||||
<div class="profile-form__submit">
|
||||
<button type="submit" class="btn-primary btn-lg" id="profile-save-btn">
|
||||
<?php esc_html_e( '保存修改', 'aksrt' ); ?>
|
||||
</button>
|
||||
<span id="profile-save-msg" class="profile-form__submit-msg"></span>
|
||||
</div>
|
||||
</form>
|
||||
<div class="profile-form__submit">
|
||||
<button type="submit" class="btn-primary btn-lg" id="profile-save-btn">
|
||||
<?php esc_html_e('保存修改', 'aksrt'); ?>
|
||||
</button>
|
||||
<span id="profile-save-msg" class="profile-form__submit-msg"></span>
|
||||
</div>
|
||||
</form>
|
||||
Reference in new issue
Block a user