feat(pages): 1:1 用户身份认证页 user-auth
Public apply/status shell on aksrt_user_verify_* meta, AJAX submit with materials upload, admin approve promotes apply payload to auth info.
This commit is contained in:
1 parent
1cb534e4fe
commit
cd04a03329
8 files changed
+602
No files matched your search
@@ -0,0 +1,89 @@
|
|||||||
|
/**
|
||||||
|
* User identity auth page styles (zibll user-auth).
|
||||||
|
*
|
||||||
|
* @package AKSRT
|
||||||
|
*/
|
||||||
|
|
||||||
|
.aksrt-user-auth-panel {
|
||||||
|
overflow: hidden;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-user-auth-panel .colorful-bg.c-blue {
|
||||||
|
background: linear-gradient(135deg, #4e9bff 0%, #2f6df6 100%);
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-user-auth-panel .muted-2-color {
|
||||||
|
color: var(--muted-2-color, #888);
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-user-auth-panel .form-control {
|
||||||
|
width: 100%;
|
||||||
|
padding: 8px 10px;
|
||||||
|
border: 1px solid var(--main-border-color, #ddd);
|
||||||
|
border-radius: 6px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-user-auth-panel .mb20 {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-user-auth-panel .mb6 {
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-user-auth-panel .but.c-blue,
|
||||||
|
.aksrt-user-auth-panel button.but {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 6px;
|
||||||
|
background: var(--focus-color, #2f6df6);
|
||||||
|
color: #fff;
|
||||||
|
border: 0;
|
||||||
|
border-radius: 6px;
|
||||||
|
padding: 10px 18px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-user-auth-panel .btn-block {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-user-auth-panel__imgs {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-user-auth-panel__imgs .preview-item {
|
||||||
|
width: 96px;
|
||||||
|
height: 96px;
|
||||||
|
border-radius: 6px;
|
||||||
|
overflow: hidden;
|
||||||
|
border: 1px solid var(--main-border-color, #eee);
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-user-auth-panel__imgs img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-user-auth-panel .c-red {
|
||||||
|
color: #e74c3c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-template-user-auth .content-wrap {
|
||||||
|
display: flex;
|
||||||
|
gap: 20px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-template-user-auth .content-layout {
|
||||||
|
flex: 1 1 0;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
/**
|
||||||
|
* User auth apply form AJAX.
|
||||||
|
*
|
||||||
|
* @package AKSRT
|
||||||
|
*/
|
||||||
|
(function () {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
function ajaxUrl() {
|
||||||
|
if (window.aksrtData && window.aksrtData.ajaxUrl) return window.aksrtData.ajaxUrl;
|
||||||
|
return '/wp-admin/admin-ajax.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
function toast(msg, type) {
|
||||||
|
if (window.aksrt && typeof window.aksrt.toast === 'function') {
|
||||||
|
window.aksrt.toast(msg, type || 'info');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line no-alert
|
||||||
|
window.alert(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
var form = document.querySelector('.aksrt-user-auth-form');
|
||||||
|
if (!form) return;
|
||||||
|
|
||||||
|
form.addEventListener('submit', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var btn = form.querySelector('button[type="submit"]');
|
||||||
|
if (btn) btn.disabled = true;
|
||||||
|
var fd = new FormData(form);
|
||||||
|
if (!fd.get('action')) fd.set('action', 'aksrt_user_auth_apply');
|
||||||
|
|
||||||
|
fetch(ajaxUrl(), {
|
||||||
|
method: 'POST',
|
||||||
|
body: fd,
|
||||||
|
credentials: 'same-origin',
|
||||||
|
})
|
||||||
|
.then(function (r) { return r.json(); })
|
||||||
|
.then(function (data) {
|
||||||
|
if (!data || data.error) {
|
||||||
|
toast((data && data.msg) || '提交失败', 'danger');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
toast(data.msg || '提交成功', 'success');
|
||||||
|
if (data.reload) {
|
||||||
|
window.setTimeout(function () { window.location.reload(); }, 500);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(function () {
|
||||||
|
toast('网络错误', 'danger');
|
||||||
|
})
|
||||||
|
.finally(function () {
|
||||||
|
if (btn) btn.disabled = false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (document.readyState === 'loading') {
|
||||||
|
document.addEventListener('DOMContentLoaded', init);
|
||||||
|
} else {
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
})();
|
||||||
@@ -258,6 +258,9 @@ if (class_exists('\AKSRT\Core\LinksPageMeta')) {
|
|||||||
if (class_exists('\AKSRT\Core\PostsNavs')) {
|
if (class_exists('\AKSRT\Core\PostsNavs')) {
|
||||||
\AKSRT\Core\PostsNavs::get_instance()->init();
|
\AKSRT\Core\PostsNavs::get_instance()->init();
|
||||||
}
|
}
|
||||||
|
if (class_exists('\AKSRT\User\AuthApply')) {
|
||||||
|
\AKSRT\User\AuthApply::get_instance()->init();
|
||||||
|
}
|
||||||
if (class_exists('\AKSRT\Messages\SiteNotice')) {
|
if (class_exists('\AKSRT\Messages\SiteNotice')) {
|
||||||
\AKSRT\Messages\SiteNotice::get_instance()->init();
|
\AKSRT\Messages\SiteNotice::get_instance()->init();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -550,6 +550,18 @@ class UsersMenus {
|
|||||||
} elseif ($status === 'verified') {
|
} elseif ($status === 'verified') {
|
||||||
delete_user_meta($user_id, 'aksrt_user_verify_reason');
|
delete_user_meta($user_id, 'aksrt_user_verify_reason');
|
||||||
}
|
}
|
||||||
|
// Promote apply payload to public auth info when approved.
|
||||||
|
if ($status === 'verified') {
|
||||||
|
$apply = get_user_meta($user_id, 'aksrt_user_verify_apply', true);
|
||||||
|
if (is_array($apply)) {
|
||||||
|
update_user_meta($user_id, 'aksrt_user_verify_info', [
|
||||||
|
'name' => (string) ($apply['name'] ?? ''),
|
||||||
|
'desc' => (string) ($apply['desc'] ?? ''),
|
||||||
|
'type' => (string) ($apply['type'] ?? ''),
|
||||||
|
'time' => current_time('Y-m-d H:i'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
$log = get_option('aksrt_verify_review_log', []);
|
$log = get_option('aksrt_verify_review_log', []);
|
||||||
$log = is_array($log) ? $log : [];
|
$log = is_array($log) ? $log : [];
|
||||||
$log[] = [
|
$log[] = [
|
||||||
|
|||||||
@@ -437,6 +437,29 @@ trait ScriptsPart1b {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 用户身份认证页(zibll user-auth.php)
|
||||||
|
if (is_page_template('templates/pages/page-user-auth.php')) {
|
||||||
|
$ua_css = get_template_directory() . '/assets/css/routes/user-auth.css';
|
||||||
|
if (file_exists($ua_css)) {
|
||||||
|
wp_enqueue_style(
|
||||||
|
'aksrt-route-user-auth',
|
||||||
|
$base_uri . '/assets/css/routes/user-auth.css',
|
||||||
|
['aksrt-tokens'],
|
||||||
|
(string) filemtime($ua_css)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$ua_js = get_template_directory() . '/assets/js/user-auth-page.js';
|
||||||
|
if (file_exists($ua_js)) {
|
||||||
|
wp_enqueue_script(
|
||||||
|
'aksrt-user-auth-page',
|
||||||
|
$base_uri . '/assets/js/user-auth-page.js',
|
||||||
|
[],
|
||||||
|
(string) filemtime($ua_js),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 交易中心共享壳层(购物车 / 订单 / 收益)
|
// 交易中心共享壳层(购物车 / 订单 / 收益)
|
||||||
$is_commerce_center = is_page_template('templates/pages/page-orders.php')
|
$is_commerce_center = is_page_template('templates/pages/page-orders.php')
|
||||||
|| is_page_template('templates/pages/page-cart.php')
|
|| is_page_template('templates/pages/page-cart.php')
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ class Templates {
|
|||||||
'templates/pages/page-posts-navs.php' => __('AKSRT - 文章导航', 'aksrt'),
|
'templates/pages/page-posts-navs.php' => __('AKSRT - 文章导航', 'aksrt'),
|
||||||
'templates/pages/page-friends.php' => __('AKSRT - 友情链接', 'aksrt'),
|
'templates/pages/page-friends.php' => __('AKSRT - 友情链接', 'aksrt'),
|
||||||
'templates/pages/page-links.php' => __('AKSRT - 网址导航', 'aksrt'),
|
'templates/pages/page-links.php' => __('AKSRT - 网址导航', 'aksrt'),
|
||||||
|
'templates/pages/page-user-auth.php' => __('AKSRT - 用户身份认证', 'aksrt'),
|
||||||
'templates/pages/page-orders.php' => __('AKSRT - 订单中心', 'aksrt'),
|
'templates/pages/page-orders.php' => __('AKSRT - 订单中心', 'aksrt'),
|
||||||
'templates/pages/page-revenue.php' => __('AKSRT - 收益中心', 'aksrt'),
|
'templates/pages/page-revenue.php' => __('AKSRT - 收益中心', 'aksrt'),
|
||||||
'templates/pages/page-cart.php' => __('AKSRT - 购物车', 'aksrt'),
|
'templates/pages/page-cart.php' => __('AKSRT - 购物车', 'aksrt'),
|
||||||
|
|||||||
@@ -0,0 +1,207 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Frontend identity verification apply (zibll user-auth page parity on aksrt_user_verify_* meta).
|
||||||
|
*
|
||||||
|
* @package AKSRT
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace AKSRT\User;
|
||||||
|
|
||||||
|
defined('ABSPATH') || exit;
|
||||||
|
|
||||||
|
class AuthApply {
|
||||||
|
|
||||||
|
public const STATUS_META = 'aksrt_user_verify_status';
|
||||||
|
public const REASON_META = 'aksrt_user_verify_reason';
|
||||||
|
public const APPLY_META = 'aksrt_user_verify_apply';
|
||||||
|
public const INFO_META = 'aksrt_user_verify_info';
|
||||||
|
|
||||||
|
private static $instance = null;
|
||||||
|
|
||||||
|
public static function get_instance(): self {
|
||||||
|
if (null === self::$instance) {
|
||||||
|
self::$instance = new self();
|
||||||
|
}
|
||||||
|
return self::$instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function init(): void {
|
||||||
|
add_action('wp_ajax_aksrt_user_auth_apply', [$this, 'ajax_apply']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array{
|
||||||
|
* enabled:bool,allow_apply:bool,public_display:bool,badge_text:string,
|
||||||
|
* limit_level:int,desc:string,disable_desc:string,
|
||||||
|
* types:array<int,array{slug:string,label:string}>
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
public static function settings(): array {
|
||||||
|
$all = class_exists('\AKSRT\Settings\Settings')
|
||||||
|
? (array) \AKSRT\Settings\Settings::get_all()
|
||||||
|
: [];
|
||||||
|
$enabled = !isset($all['user_verify_enabled']) || !empty($all['user_verify_enabled']);
|
||||||
|
$types_raw = (string) ($all['user_verify_apply_option'] ?? "real_name|实名认证\norganization|企业认证");
|
||||||
|
$types = [];
|
||||||
|
foreach (preg_split('/\r\n|\r|\n/', $types_raw) as $line) {
|
||||||
|
$line = trim($line);
|
||||||
|
if ($line === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$parts = array_map('trim', explode('|', $line, 2));
|
||||||
|
$slug = sanitize_key($parts[0] ?? '');
|
||||||
|
$label = $parts[1] ?? $parts[0];
|
||||||
|
if ($slug === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$types[] = ['slug' => $slug, 'label' => (string) $label];
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
'enabled' => $enabled,
|
||||||
|
'allow_apply' => !isset($all['user_verify_allow_apply']) || !empty($all['user_verify_allow_apply']),
|
||||||
|
'public_display' => !isset($all['user_verify_public_display']) || !empty($all['user_verify_public_display']),
|
||||||
|
'badge_text' => (string) ($all['user_verify_badge_text'] ?? __('已认证', 'aksrt')),
|
||||||
|
'limit_level' => max(0, (int) ($all['user_verify_limit_level'] ?? 0)),
|
||||||
|
'desc' => (string) ($all['user_verify_desc'] ?? ''),
|
||||||
|
'disable_desc' => (string) ($all['user_verify_disable_desc'] ?? ''),
|
||||||
|
'types' => $types,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function get_status(int $user_id): string {
|
||||||
|
if ($user_id <= 0) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return sanitize_key((string) get_user_meta($user_id, self::STATUS_META, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function is_verified(int $user_id): bool {
|
||||||
|
return self::get_status($user_id) === 'verified';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string,mixed>
|
||||||
|
*/
|
||||||
|
public static function get_auth_info(int $user_id): array {
|
||||||
|
$info = get_user_meta($user_id, self::INFO_META, true);
|
||||||
|
return is_array($info) ? $info : [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string,mixed>
|
||||||
|
*/
|
||||||
|
public static function get_apply_payload(int $user_id): array {
|
||||||
|
$apply = get_user_meta($user_id, self::APPLY_META, true);
|
||||||
|
return is_array($apply) ? $apply : [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function ajax_apply(): void {
|
||||||
|
if (!is_user_logged_in()) {
|
||||||
|
wp_send_json(['error' => 1, 'msg' => __('请先登录', 'aksrt')]);
|
||||||
|
}
|
||||||
|
if (!check_ajax_referer('aksrt_user_auth_apply', '_wpnonce', false)) {
|
||||||
|
wp_send_json(['error' => 1, 'msg' => __('安全校验失败', 'aksrt')]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$user_id = get_current_user_id();
|
||||||
|
$s = self::settings();
|
||||||
|
if (!$s['enabled'] || !$s['allow_apply']) {
|
||||||
|
wp_send_json(['error' => 1, 'msg' => __('暂不能申请身份认证', 'aksrt')]);
|
||||||
|
}
|
||||||
|
if (self::is_verified($user_id)) {
|
||||||
|
wp_send_json(['error' => 1, 'msg' => __('您已是认证用户', 'aksrt')]);
|
||||||
|
}
|
||||||
|
if (self::get_status($user_id) === 'pending') {
|
||||||
|
wp_send_json(['error' => 1, 'msg' => __('您的申请正在审核中', 'aksrt')]);
|
||||||
|
}
|
||||||
|
if ($s['limit_level'] > 0 && class_exists('\AKSRT\User\Level')) {
|
||||||
|
$lv = (int) Level::get_level($user_id);
|
||||||
|
if ($lv < $s['limit_level']) {
|
||||||
|
wp_send_json([
|
||||||
|
'error' => 1,
|
||||||
|
'msg' => sprintf(
|
||||||
|
/* translators: %d: required level */
|
||||||
|
__('等级不足,需达到 LV.%d 后申请', 'aksrt'),
|
||||||
|
$s['limit_level']
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$name = isset($_POST['name']) ? sanitize_text_field(wp_unslash((string) $_POST['name'])) : '';
|
||||||
|
$desc = isset($_POST['desc']) ? sanitize_textarea_field(wp_unslash((string) $_POST['desc'])) : '';
|
||||||
|
$msg = isset($_POST['msg']) ? sanitize_textarea_field(wp_unslash((string) $_POST['msg'])) : '';
|
||||||
|
$type = isset($_POST['type']) ? sanitize_key((string) wp_unslash($_POST['type'])) : '';
|
||||||
|
if ($name === '') {
|
||||||
|
wp_send_json(['error' => 1, 'msg' => __('请填写认证身份名称', 'aksrt')]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$images = [];
|
||||||
|
if (!empty($_FILES['image']['name'])) {
|
||||||
|
require_once ABSPATH . 'wp-admin/includes/file.php';
|
||||||
|
require_once ABSPATH . 'wp-admin/includes/media.php';
|
||||||
|
require_once ABSPATH . 'wp-admin/includes/image.php';
|
||||||
|
|
||||||
|
$files = $_FILES['image'];
|
||||||
|
// Normalize multi-file upload.
|
||||||
|
$names = $files['name'];
|
||||||
|
if (!is_array($names)) {
|
||||||
|
$names = [$names];
|
||||||
|
$tmp = [
|
||||||
|
'name' => $names,
|
||||||
|
'type' => [$files['type']],
|
||||||
|
'tmp_name' => [$files['tmp_name']],
|
||||||
|
'error' => [$files['error']],
|
||||||
|
'size' => [$files['size']],
|
||||||
|
];
|
||||||
|
$files = $tmp;
|
||||||
|
}
|
||||||
|
$count = min(3, count($files['name']));
|
||||||
|
for ($i = 0; $i < $count; $i++) {
|
||||||
|
if (empty($files['name'][$i]) || (int) $files['error'][$i] !== UPLOAD_ERR_OK) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$file = [
|
||||||
|
'name' => $files['name'][$i],
|
||||||
|
'type' => $files['type'][$i],
|
||||||
|
'tmp_name' => $files['tmp_name'][$i],
|
||||||
|
'error' => $files['error'][$i],
|
||||||
|
'size' => $files['size'][$i],
|
||||||
|
];
|
||||||
|
$_FILES['aksrt_auth_img'] = $file;
|
||||||
|
$aid = media_handle_upload('aksrt_auth_img', 0);
|
||||||
|
if (!is_wp_error($aid)) {
|
||||||
|
$url = wp_get_attachment_url((int) $aid);
|
||||||
|
if ($url) {
|
||||||
|
$images[] = $url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($_FILES['aksrt_auth_img']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$payload = [
|
||||||
|
'name' => $name,
|
||||||
|
'desc' => $desc,
|
||||||
|
'msg' => $msg,
|
||||||
|
'type' => $type,
|
||||||
|
'img' => $images,
|
||||||
|
'time' => current_time('Y-m-d H:i'),
|
||||||
|
];
|
||||||
|
update_user_meta($user_id, self::APPLY_META, $payload);
|
||||||
|
update_user_meta($user_id, self::STATUS_META, 'pending');
|
||||||
|
delete_user_meta($user_id, self::REASON_META);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $user_id
|
||||||
|
* @param array $payload
|
||||||
|
*/
|
||||||
|
do_action('aksrt_user_auth_apply_submitted', $user_id, $payload);
|
||||||
|
|
||||||
|
wp_send_json([
|
||||||
|
'error' => 0,
|
||||||
|
'msg' => __('提交成功,请等待管理员审核', 'aksrt'),
|
||||||
|
'reload' => true,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,203 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Template Name: AKSRT - 用户身份认证
|
||||||
|
* Template Post Type: page
|
||||||
|
*
|
||||||
|
* Zibll pages/user-auth.php 1:1 shell on aksrt_user_verify_* storage.
|
||||||
|
*
|
||||||
|
* @package AKSRT
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('ABSPATH') || exit;
|
||||||
|
|
||||||
|
use AKSRT\User\AuthApply;
|
||||||
|
|
||||||
|
$settings = class_exists(AuthApply::class) ? AuthApply::settings() : ['enabled' => true, 'allow_apply' => true];
|
||||||
|
$user_id = get_current_user_id();
|
||||||
|
$status = $user_id && class_exists(AuthApply::class) ? AuthApply::get_status($user_id) : '';
|
||||||
|
$info = $user_id && class_exists(AuthApply::class) ? AuthApply::get_auth_info($user_id) : [];
|
||||||
|
$apply = $user_id && class_exists(AuthApply::class) ? AuthApply::get_apply_payload($user_id) : [];
|
||||||
|
$login_url = function_exists('aksrt_get_login_url') ? aksrt_get_login_url(get_permalink()) : wp_login_url(get_permalink());
|
||||||
|
|
||||||
|
get_header();
|
||||||
|
?>
|
||||||
|
<main class="container page-template-user-auth">
|
||||||
|
<div class="content-wrap">
|
||||||
|
<div class="content-layout">
|
||||||
|
<?php while (have_posts()) : the_post(); ?>
|
||||||
|
<div class="nopw-sm box-body theme-box radius8 main-bg main-shadow">
|
||||||
|
<article class="article wp-posts-content">
|
||||||
|
<?php
|
||||||
|
the_content();
|
||||||
|
wp_link_pages([
|
||||||
|
'before' => '<p class="text-center post-nav-links radius8 padding-6">',
|
||||||
|
'after' => '</p>',
|
||||||
|
]);
|
||||||
|
?>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
<?php endwhile; ?>
|
||||||
|
|
||||||
|
<div class="theme-box radius8 main-bg main-shadow relative-h aksrt-user-auth-panel">
|
||||||
|
<?php if (empty($settings['enabled'])) : ?>
|
||||||
|
<div class="colorful-bg c-blue flex jc" style="min-height:120px;align-items:center;justify-content:center;">
|
||||||
|
<div class="text-center">
|
||||||
|
<div class="em2x"><i class="fa fa-id-badge" aria-hidden="true"></i></div>
|
||||||
|
<div class="mt10 em12"><?php esc_html_e('身份认证功能未启用', 'aksrt'); ?></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php elseif ($status === 'verified') : ?>
|
||||||
|
<?php
|
||||||
|
$name = (string) ($info['name'] ?? ($apply['name'] ?? __('官方认证', 'aksrt')));
|
||||||
|
$desc = (string) ($info['desc'] ?? ($apply['desc'] ?? ''));
|
||||||
|
$time = (string) ($info['time'] ?? get_user_meta($user_id, 'aksrt_user_verify_reviewed_at', true));
|
||||||
|
?>
|
||||||
|
<div class="colorful-bg c-blue flex ac jse aksrt-user-auth-panel__verified" style="padding:30px 16px;gap:20px;flex-wrap:wrap;">
|
||||||
|
<div class="text-center flex0">
|
||||||
|
<div class="em3x"><i class="fa fa-id-badge" aria-hidden="true"></i></div>
|
||||||
|
<div class="mt10 padding-w10"><?php esc_html_e('我的认证信息', 'aksrt'); ?></div>
|
||||||
|
</div>
|
||||||
|
<div class="box-body">
|
||||||
|
<div><i class="fa fa-check-circle" aria-hidden="true"></i> <b class="ml3"><?php echo esc_html($name); ?></b></div>
|
||||||
|
<?php if ($desc !== '') : ?>
|
||||||
|
<div class="muted-2-color mt10"><?php echo esc_html($desc); ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($time !== '') : ?>
|
||||||
|
<div class="muted-2-color mt10"><?php echo esc_html(sprintf(__('认证时间:%s', 'aksrt'), $time)); ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php elseif (!$user_id) : ?>
|
||||||
|
<div class="colorful-bg c-blue flex jc" style="min-height:120px;align-items:center;justify-content:center;padding:24px;">
|
||||||
|
<div class="text-center">
|
||||||
|
<div class="em2x"><i class="fa fa-id-badge" aria-hidden="true"></i></div>
|
||||||
|
<div class="em12 padding-w10 mt10"><?php esc_html_e('申请身份认证', 'aksrt'); ?></div>
|
||||||
|
<p class="mt20">
|
||||||
|
<a class="but c-blue padding-lg signin-loader" href="<?php echo esc_url($login_url); ?>">
|
||||||
|
<i class="fa fa-sign-in mr6" aria-hidden="true"></i><?php esc_html_e('登录后申请', 'aksrt'); ?>
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php elseif ($status === 'pending') : ?>
|
||||||
|
<div class="box-body" style="padding:24px;">
|
||||||
|
<div class="c-red mb10"><?php esc_html_e('您的申请正在审核中,请耐心等待', 'aksrt'); ?></div>
|
||||||
|
<div><i class="fa fa-id-badge" aria-hidden="true"></i> <b class="ml3"><?php echo esc_html((string) ($apply['name'] ?? '')); ?></b></div>
|
||||||
|
<?php if (!empty($apply['desc'])) : ?>
|
||||||
|
<div class="muted-2-color mt10"><?php echo esc_html((string) $apply['desc']); ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (!empty($apply['msg'])) : ?>
|
||||||
|
<div class="muted-2-color mt10"><?php echo esc_html(sprintf(__('申请说明:%s', 'aksrt'), (string) $apply['msg'])); ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (!empty($apply['time'])) : ?>
|
||||||
|
<div class="muted-2-color mt10"><?php echo esc_html(sprintf(__('申请时间:%s', 'aksrt'), (string) $apply['time'])); ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (!empty($apply['img']) && is_array($apply['img'])) : ?>
|
||||||
|
<div class="mt20 aksrt-user-auth-panel__imgs">
|
||||||
|
<?php foreach ($apply['img'] as $img_url) : ?>
|
||||||
|
<div class="preview-item"><img src="<?php echo esc_url((string) $img_url); ?>" alt=""></div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<?php elseif (empty($settings['allow_apply'])) : ?>
|
||||||
|
<div class="box-body" style="padding:24px;">
|
||||||
|
<div class="c-red"><i class="fa mr6 fa-info-circle" aria-hidden="true"></i><?php esc_html_e('抱歉!暂时不能申请身份认证', 'aksrt'); ?></div>
|
||||||
|
<?php if (!empty($settings['disable_desc'])) : ?>
|
||||||
|
<div class="muted-color mt20"><?php echo wp_kses_post(nl2br(esc_html((string) $settings['disable_desc']))); ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<?php else : ?>
|
||||||
|
<?php
|
||||||
|
$blocked_level = false;
|
||||||
|
$limit = (int) ($settings['limit_level'] ?? 0);
|
||||||
|
if ($limit > 0 && class_exists('\AKSRT\User\Level')) {
|
||||||
|
$lv = (int) \AKSRT\User\Level::get_level($user_id);
|
||||||
|
if ($lv < $limit) {
|
||||||
|
$blocked_level = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?php if ($blocked_level) : ?>
|
||||||
|
<div class="box-body" style="padding:24px;">
|
||||||
|
<div class="c-red"><i class="fa mr6 fa-info-circle" aria-hidden="true"></i><?php esc_html_e('抱歉!您暂时不能申请身份认证', 'aksrt'); ?></div>
|
||||||
|
<div class="muted-color mt20">
|
||||||
|
<?php
|
||||||
|
printf(
|
||||||
|
/* translators: %d level */
|
||||||
|
esc_html__('由于您的等级过低,请升级到 LV.%d 后再来申请', 'aksrt'),
|
||||||
|
$limit
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php else : ?>
|
||||||
|
<div class="colorful-bg c-blue flex ac" style="height:100px;justify-content:center;gap:10px;">
|
||||||
|
<div class="em2x"><i class="fa fa-id-badge" aria-hidden="true"></i></div>
|
||||||
|
<div class="em12 padding-w10"><?php esc_html_e('申请身份认证', 'aksrt'); ?></div>
|
||||||
|
</div>
|
||||||
|
<div class="box-body" style="padding:20px;">
|
||||||
|
<?php if ($status === 'rejected') : ?>
|
||||||
|
<div class="c-red mb15">
|
||||||
|
<?php esc_html_e('上次申请未通过,可修改资料后重新提交。', 'aksrt'); ?>
|
||||||
|
<?php
|
||||||
|
$reason = (string) get_user_meta($user_id, AuthApply::REASON_META, true);
|
||||||
|
if ($reason !== '') {
|
||||||
|
echo '<div class="muted-2-color mt6">' . esc_html(sprintf(__('原因:%s', 'aksrt'), $reason)) . '</div>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (!empty($settings['desc'])) : ?>
|
||||||
|
<div class="muted-color mb20"><?php echo wp_kses_post(nl2br(esc_html((string) $settings['desc']))); ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<form class="aksrt-user-auth-form form-upload" enctype="multipart/form-data">
|
||||||
|
<?php if (!empty($settings['types'])) : ?>
|
||||||
|
<div class="mb20">
|
||||||
|
<div class="em09 muted-2-color mb6"><?php esc_html_e('认证类型', 'aksrt'); ?></div>
|
||||||
|
<select class="form-control" name="type">
|
||||||
|
<?php foreach ($settings['types'] as $t) : ?>
|
||||||
|
<option value="<?php echo esc_attr($t['slug']); ?>"><?php echo esc_html($t['label']); ?></option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<div class="mb20">
|
||||||
|
<div class="em09 muted-2-color mb6"><?php esc_html_e('认证身份', 'aksrt'); ?></div>
|
||||||
|
<input type="text" class="form-control" name="name" required placeholder="<?php esc_attr_e('请输入身份名称', 'aksrt'); ?>" value="<?php echo esc_attr((string) ($apply['name'] ?? '')); ?>">
|
||||||
|
</div>
|
||||||
|
<div class="mb20">
|
||||||
|
<div class="em09 muted-2-color mb6"><?php esc_html_e('身份简介', 'aksrt'); ?></div>
|
||||||
|
<textarea class="form-control" name="desc" rows="2" placeholder="<?php esc_attr_e('请输入申请的身份简介', 'aksrt'); ?>"><?php echo esc_textarea((string) ($apply['desc'] ?? '')); ?></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="mb20">
|
||||||
|
<div class="em09 muted-2-color mb6"><?php esc_html_e('申请说明', 'aksrt'); ?></div>
|
||||||
|
<textarea class="form-control" name="msg" rows="2" placeholder="<?php esc_attr_e('请输入申请缘由及说明', 'aksrt'); ?>"><?php echo esc_textarea((string) ($apply['msg'] ?? '')); ?></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="mb20">
|
||||||
|
<div class="em09 muted-2-color mb6"><?php esc_html_e('证明材料', 'aksrt'); ?></div>
|
||||||
|
<input type="file" name="image[]" accept="image/gif,image/jpeg,image/jpg,image/png" multiple>
|
||||||
|
<div class="px12 muted-2-color mt6"><?php esc_html_e('最多 3 张图片', 'aksrt'); ?></div>
|
||||||
|
</div>
|
||||||
|
<?php wp_nonce_field('aksrt_user_auth_apply', '_wpnonce', false); ?>
|
||||||
|
<input type="hidden" name="action" value="aksrt_user_auth_apply">
|
||||||
|
<button type="submit" class="but c-blue padding-lg btn-block">
|
||||||
|
<i class="fa fa-check" aria-hidden="true"></i> <?php esc_html_e('确认提交', 'aksrt'); ?>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if (comments_open() || get_comments_number()) {
|
||||||
|
comments_template();
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php get_sidebar(); ?>
|
||||||
|
</main>
|
||||||
|
<?php
|
||||||
|
get_footer();
|
||||||
Reference in new issue
Block a user