fix(user-center): embed official certification panel
This commit is contained in:
1 parent
d3bf75fbea
commit
0a04c3e4cc
22 files changed
+415
-461
No files matched your search
@@ -547,7 +547,8 @@ class UsersMenus {
|
||||
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>';
|
||||
$evidence_src = class_exists('\AKSRT\User\AuthApply') ? \AKSRT\User\AuthApply::evidence_src((string) $image_url) : '';
|
||||
echo '<a href="' . esc_attr($evidence_src) . '" target="_blank" rel="noopener noreferrer"><img src="' . esc_attr($evidence_src) . '" alt="" style="width:56px;height:56px;object-fit:cover;margin:6px 6px 0 0;border-radius:4px;" /></a>';
|
||||
}
|
||||
}
|
||||
if (!empty($row['verify_reason'])) {
|
||||
@@ -588,7 +589,17 @@ class UsersMenus {
|
||||
check_admin_referer('aksrt_users_review_verify_' . $user_id);
|
||||
|
||||
$ok = false;
|
||||
if ($user_id > 0 && in_array($status, ['verified', 'rejected'], true) && get_userdata($user_id)) {
|
||||
$current_status = sanitize_key((string) get_user_meta($user_id, 'aksrt_user_verify_status', true));
|
||||
$application = get_user_meta($user_id, 'aksrt_user_verify_apply', true);
|
||||
if (
|
||||
$user_id > 0
|
||||
&& in_array($status, ['verified', 'rejected'], true)
|
||||
&& get_userdata($user_id)
|
||||
&& $current_status === 'pending'
|
||||
&& is_array($application)
|
||||
&& !empty($application['name'])
|
||||
&& !empty($application['type'])
|
||||
) {
|
||||
update_user_meta($user_id, 'aksrt_user_verify_status', $status);
|
||||
update_user_meta($user_id, 'aksrt_user_verify_reviewed_at', current_time('mysql'));
|
||||
update_user_meta($user_id, 'aksrt_user_verify_reviewer', get_current_user_id());
|
||||
@@ -619,6 +630,15 @@ class UsersMenus {
|
||||
'time' => current_time('mysql'),
|
||||
];
|
||||
update_option('aksrt_verify_review_log', array_slice($log, -500), false);
|
||||
if (class_exists('\AKSRT\Messages\Message')) {
|
||||
$message = $status === 'verified'
|
||||
? __('您的官方认证申请已通过审核', 'aksrt')
|
||||
: sprintf(__('您的官方认证申请未通过:%s', 'aksrt'), $note !== '' ? $note : __('请修改资料后重新申请', 'aksrt'));
|
||||
\AKSRT\Messages\Message::get_instance()->send($user_id, 'auth_apply_reply', $message, [
|
||||
'title' => __('官方认证审核结果', 'aksrt'),
|
||||
'target_url' => aksrt_get_user_center_tab_url('auth'),
|
||||
]);
|
||||
}
|
||||
$ok = true;
|
||||
}
|
||||
$this->redirect('aksrt_user_auth', $ok ? 'verify_updated' : 'verify_failed', ['status' => 'pending']);
|
||||
|
||||
@@ -515,7 +515,7 @@ class SchemaUsers {
|
||||
'option_key' => 'aksrt_settings',
|
||||
'groups' => [
|
||||
['key' => 'center', 'title' => '用户中心', 'fields' => [
|
||||
['key' => 'user_center_tabs', 'label' => '用户中心 Tab', 'type' => 'input', 'default' => 'profile,posts,comments,favorites,vip,credits', 'help' => '逗号分隔。vip=我的会员(会员功能开启时也会自动注入)'],
|
||||
['key' => 'user_center_tabs', 'label' => '用户中心 Tab', 'type' => 'input', 'default' => 'profile,posts,comments,favorites,vip,credits,auth', 'help' => '逗号分隔。auth=官方认证;vip、订单和认证会按功能开关自动注入'],
|
||||
['key' => 'user_avatar_upload', 'label' => '头像上传', 'type' => 'switch', 'default' => true],
|
||||
['key' => 'user_cover_upload', 'label' => '封面上传', 'type' => 'switch', 'default' => true],
|
||||
['key' => 'user_social_links', 'label' => '社交链接', 'type' => 'switch', 'default' => true],
|
||||
|
||||
@@ -179,6 +179,11 @@ trait UserControllerVerifyIntegrations {
|
||||
if (!$user) {
|
||||
return $this->error(__('用户不存在', 'aksrt'), 404);
|
||||
}
|
||||
$current_status = sanitize_key((string) get_user_meta($user_id, 'aksrt_user_verify_status', true));
|
||||
$application = get_user_meta($user_id, 'aksrt_user_verify_apply', true);
|
||||
if ($current_status !== 'pending' || !is_array($application) || empty($application['name']) || empty($application['type'])) {
|
||||
return $this->error(__('该用户没有可审核的认证申请', 'aksrt'), 409);
|
||||
}
|
||||
|
||||
update_user_meta($user_id, 'aksrt_user_verify_status', $status);
|
||||
update_user_meta($user_id, 'aksrt_user_verify_reviewed_at', current_time('mysql'));
|
||||
@@ -216,6 +221,15 @@ trait UserControllerVerifyIntegrations {
|
||||
$log = array_slice($log, -500);
|
||||
}
|
||||
update_option('aksrt_verify_review_log', $log, false);
|
||||
if (class_exists('\AKSRT\Messages\Message')) {
|
||||
$message = $status === 'verified'
|
||||
? __('您的官方认证申请已通过审核', 'aksrt')
|
||||
: sprintf(__('您的官方认证申请未通过:%s', 'aksrt'), $note !== '' ? $note : __('请修改资料后重新申请', 'aksrt'));
|
||||
\AKSRT\Messages\Message::get_instance()->send($user_id, 'auth_apply_reply', $message, [
|
||||
'title' => __('官方认证审核结果', 'aksrt'),
|
||||
'target_url' => aksrt_get_user_center_tab_url('auth'),
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->success([
|
||||
'message' => $status === 'verified'
|
||||
@@ -239,7 +253,7 @@ trait UserControllerVerifyIntegrations {
|
||||
'email' => (string) ($row['user_email'] ?? ''),
|
||||
'status' => $status,
|
||||
'reason' => (string) ($row['verify_reason'] ?? ''),
|
||||
'requested_at' => (string) ($row['user_registered'] ?? ''),
|
||||
'requested_at' => (string) ($application['time'] ?? $row['user_registered'] ?? ''),
|
||||
'reviewed_at' => (string) ($row['reviewed_at'] ?? ''),
|
||||
'email_verified' => $email_verified,
|
||||
'application' => $application,
|
||||
|
||||
Reference in new issue
Block a user