From 714676c612689ce99805b5d6b4ca9e9d92a85c0f Mon Sep 17 00:00:00 2001 From: Fall-Rain <36319339+Fall-Rain@users.noreply.github.com> Date: Sat, 12 Nov 2022 10:38:28 +0800 Subject: [PATCH] feat: optimize comment box style (#506) --- inc/theme-article.php | 23 ++++++++++++++++++++++- style.css | 5 +++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/inc/theme-article.php b/inc/theme-article.php index da5afd6..a4d0c90 100644 --- a/inc/theme-article.php +++ b/inc/theme-article.php @@ -229,9 +229,11 @@ function comment_err($a) exit; } +if (!function_exists('comment_callback')): function comment_callback() { $comment = wp_handle_comment_submission(wp_unslash($_POST)); + $commenter = wp_get_current_commenter(); if (is_wp_error($comment)) { $data = $comment->get_error_data(); if (!empty($data)) { @@ -243,6 +245,11 @@ function comment_callback() $user = wp_get_current_user(); do_action('set_comment_cookies', $comment, $user); $GLOBALS['comment'] = $comment; + if ($commenter['comment_author_email']) { + $moderation_note = __('Your comment is awaiting moderation.'); + } else { + $moderation_note = __('Your comment is awaiting moderation. This is a preview; your comment will be visible after it has been approved.'); + } ?>