进行了一些小优化
This commit is contained in:
1 parent
4a4009133c
commit
11f1c23fa7
12 files changed
+463
-10
No files matched your search
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* User center notification preferences panel.
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
$context = is_array($args['context'] ?? null) ? $args['context'] : [];
|
||||
$user_id = (int) ($context['user_id'] ?? get_current_user_id());
|
||||
$preferences = class_exists('\AKSRT\User\NotificationPreferences')
|
||||
? \AKSRT\User\NotificationPreferences::get($user_id)
|
||||
: ['posts' => true, 'like' => true, 'system' => true];
|
||||
$items = [
|
||||
'posts' => [
|
||||
'title' => __('文章评论', 'aksrt'),
|
||||
'description' => __('接收文章、评论、收藏等相关消息', 'aksrt'),
|
||||
],
|
||||
'like' => [
|
||||
'title' => __('点赞喜欢', 'aksrt'),
|
||||
'description' => __('接收点赞、关注等相关消息', 'aksrt'),
|
||||
],
|
||||
'system' => [
|
||||
'title' => __('系统消息', 'aksrt'),
|
||||
'description' => __('接收订单、活动、等系统消息', 'aksrt'),
|
||||
],
|
||||
];
|
||||
?>
|
||||
<form class="uc-notification-preferences" data-aksrt-notification-preferences>
|
||||
<div class="uc-notification-preferences__header">
|
||||
<div>
|
||||
<h2><?php esc_html_e('消息通知', 'aksrt'); ?></h2>
|
||||
<p><?php esc_html_e('选择你希望接收的站内消息类型。', 'aksrt'); ?></p>
|
||||
</div>
|
||||
<span class="uc-notification-preferences__header-icon" aria-hidden="true"><i class="fa fas fa-bell"></i></span>
|
||||
</div>
|
||||
|
||||
<div class="uc-notification-preferences__list">
|
||||
<?php foreach ($items as $key => $item) : ?>
|
||||
<label class="uc-notification-preference" for="aksrt-notification-<?php echo esc_attr($key); ?>">
|
||||
<span class="uc-notification-preference__copy">
|
||||
<strong><?php echo esc_html($item['title']); ?></strong>
|
||||
<small><?php echo esc_html($item['description']); ?></small>
|
||||
</span>
|
||||
<span class="uc-notification-switch">
|
||||
<input id="aksrt-notification-<?php echo esc_attr($key); ?>" type="checkbox" name="<?php echo esc_attr($key); ?>" value="1" role="switch" <?php checked(!empty($preferences[$key])); ?>>
|
||||
<span aria-hidden="true"></span>
|
||||
</span>
|
||||
</label>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<div class="uc-notification-preferences__footer">
|
||||
<button type="submit" class="btn-primary"><?php esc_html_e('保存设置', 'aksrt'); ?></button>
|
||||
</div>
|
||||
</form>
|
||||
Reference in new issue
Block a user