fix(user-center): connect certification workflow
This commit is contained in:
@@ -525,7 +525,35 @@ class UsersMenus {
|
||||
echo '<td>' . esc_html((string) ($row['display_name'] ?? '')) . '</td>';
|
||||
echo '<td>' . esc_html((string) ($row['user_email'] ?? '')) . '</td>';
|
||||
echo '<td>' . esc_html($st) . '</td>';
|
||||
echo '<td>' . esc_html((string) ($row['verify_reason'] ?? '')) . '</td>';
|
||||
$apply = get_user_meta($uid, 'aksrt_user_verify_apply', true);
|
||||
$apply = is_array($apply) ? $apply : [];
|
||||
$type_labels = [];
|
||||
if (class_exists('\AKSRT\User\AuthApply')) {
|
||||
foreach ((array) \AKSRT\User\AuthApply::settings()['types'] as $type) {
|
||||
$type_labels[(string) ($type['slug'] ?? '')] = (string) ($type['label'] ?? '');
|
||||
}
|
||||
}
|
||||
echo '<td>';
|
||||
if ($apply) {
|
||||
$type_key = sanitize_key((string) ($apply['type'] ?? ''));
|
||||
echo '<strong>' . esc_html((string) ($apply['name'] ?? '')) . '</strong>';
|
||||
if ($type_key !== '') {
|
||||
echo '<div><span class="dashicons dashicons-id" aria-hidden="true"></span> ' . esc_html($type_labels[$type_key] ?? $type_key) . '</div>';
|
||||
}
|
||||
if (!empty($apply['desc'])) {
|
||||
echo '<div>' . esc_html((string) $apply['desc']) . '</div>';
|
||||
}
|
||||
if (!empty($apply['msg'])) {
|
||||
echo '<div class="description">' . esc_html((string) $apply['msg']) . '</div>';
|
||||
}
|
||||
foreach ((array) ($apply['img'] ?? []) as $image_url) {
|
||||
echo '<a href="' . esc_url((string) $image_url) . '" target="_blank" rel="noopener noreferrer"><img src="' . esc_url((string) $image_url) . '" alt="" style="width:56px;height:56px;object-fit:cover;margin:6px 6px 0 0;border-radius:4px;" /></a>';
|
||||
}
|
||||
}
|
||||
if (!empty($row['verify_reason'])) {
|
||||
echo '<div class="description">' . esc_html((string) $row['verify_reason']) . '</div>';
|
||||
}
|
||||
echo '</td>';
|
||||
echo '<td>';
|
||||
if ($st === 'pending') {
|
||||
foreach (['verified' => __('通过', 'aksrt'), 'rejected' => __('拒绝', 'aksrt')] as $action => $label) {
|
||||
|
||||
@@ -600,7 +600,6 @@ class SchemaUsers {
|
||||
['key' => 'user_verify_badge_text', 'label' => '认证徽标文案', 'type' => 'input', 'default' => '已认证'],
|
||||
]],
|
||||
['key' => 'workflow', 'title' => '审核流程', 'fields' => [
|
||||
['key' => 'user_verify_accept_email_verified', 'label' => '邮箱验证通过视为已认证', 'type' => 'switch', 'default' => true],
|
||||
['key' => 'user_verify_require_manual_review', 'label' => '保留人工审核位', 'type' => 'switch', 'default' => false],
|
||||
['key' => 'user_verify_apply_option', 'label' => '申请类型选项', 'type' => 'textarea', 'default' => "real_name|实名认证\norganization|企业认证", 'desc' => '每行:slug|显示名称'],
|
||||
]],
|
||||
|
||||
@@ -189,6 +189,17 @@ trait UserControllerVerifyIntegrations {
|
||||
} elseif ($status === 'verified') {
|
||||
delete_user_meta($user_id, 'aksrt_user_verify_reason');
|
||||
}
|
||||
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', []);
|
||||
if (!is_array($log)) {
|
||||
@@ -219,6 +230,8 @@ trait UserControllerVerifyIntegrations {
|
||||
$reviewer = $reviewer_id > 0 ? get_userdata($reviewer_id) : null;
|
||||
$status = sanitize_key((string) ($row['verify_status'] ?? 'pending'));
|
||||
$email_verified = (bool) get_user_meta($user_id, 'aksrt_email_verified', true);
|
||||
$application = get_user_meta($user_id, 'aksrt_user_verify_apply', true);
|
||||
$application = is_array($application) ? $application : [];
|
||||
|
||||
return [
|
||||
'user_id' => $user_id,
|
||||
@@ -229,6 +242,7 @@ trait UserControllerVerifyIntegrations {
|
||||
'requested_at' => (string) ($row['user_registered'] ?? ''),
|
||||
'reviewed_at' => (string) ($row['reviewed_at'] ?? ''),
|
||||
'email_verified' => $email_verified,
|
||||
'application' => $application,
|
||||
'reviewer' => $this->build_admin_user_summary($reviewer_id, $reviewer),
|
||||
'history_count' => count($this->get_verify_history_for_user($user_id)),
|
||||
];
|
||||
|
||||
@@ -624,7 +624,16 @@ $hmb_js = get_template_directory() . '/assets/js/header-newadd.js';
|
||||
}
|
||||
|
||||
// 用户身份认证页(zibll user-auth.php)
|
||||
if (is_page_template('templates/pages/page-user-auth.php')) {
|
||||
$is_user_auth_page = (bool) get_query_var('aksrt_user_auth')
|
||||
|| is_page_template('templates/pages/page-user-auth.php')
|
||||
|| (
|
||||
is_page()
|
||||
&& (
|
||||
(string) get_post_field('post_name', get_queried_object_id()) === 'user-auth'
|
||||
|| (string) get_post_meta(get_queried_object_id(), '_wp_page_template', true) === 'templates/pages/page-user-auth.php'
|
||||
)
|
||||
);
|
||||
if ($is_user_auth_page) {
|
||||
$ua_css = get_template_directory() . '/assets/css/routes/user-auth.css';
|
||||
if (file_exists($ua_css)) {
|
||||
wp_enqueue_style(
|
||||
|
||||
@@ -161,7 +161,7 @@ class UserRuntime {
|
||||
'enabled' => !isset($settings['user_verify_enabled']) || !empty($settings['user_verify_enabled']),
|
||||
'public_display' => !isset($settings['user_verify_public_display']) || !empty($settings['user_verify_public_display']),
|
||||
'badge_text' => $verify_badge_text !== '' ? $verify_badge_text : __('已认证', 'aksrt'),
|
||||
'accept_email_verified' => !isset($settings['user_verify_accept_email_verified']) || !empty($settings['user_verify_accept_email_verified']),
|
||||
'accept_email_verified' => false,
|
||||
'require_manual_review' => !empty($settings['user_verify_require_manual_review']),
|
||||
'allow_apply' => !isset($settings['user_verify_allow_apply']) || !empty($settings['user_verify_allow_apply']),
|
||||
'disable_desc' => (string) ($settings['user_verify_disable_desc'] ?? ''),
|
||||
|
||||
@@ -132,9 +132,13 @@ class AuthApply {
|
||||
$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'])) : '';
|
||||
$allowed_types = array_column((array) $s['types'], 'slug');
|
||||
if ($name === '') {
|
||||
wp_send_json(['error' => 1, 'msg' => __('请填写认证身份名称', 'aksrt')]);
|
||||
}
|
||||
if ($type === '' || !in_array($type, $allowed_types, true)) {
|
||||
wp_send_json(['error' => 1, 'msg' => __('请选择有效的认证类型', 'aksrt')]);
|
||||
}
|
||||
|
||||
$images = [];
|
||||
if (!empty($_FILES['image']['name'])) {
|
||||
|
||||
Reference in New Issue
Block a user