diff --git a/comments.php b/comments.php
index 01f8df4..6228e4d 100644
--- a/comments.php
+++ b/comments.php
@@ -52,6 +52,7 @@
if(comments_open()){
if(akina_option('norobot')) $robot_comments = '';
$private_ms = akina_option('open_private_message') ? '' : '';
+ $mail_notify = akina_option('mail_notify') ? '' : '';
$args = array(
'id_form' => 'commentform',
'id_submit' => 'submit',
@@ -93,7 +94,7 @@
'email' =>
'
',
'url' =>
- '' . $robot_comments . $private_ms ,
+ '' . $robot_comments . $private_ms . $mail_notify ,
'qq' =>
''
)
diff --git a/functions.php b/functions.php
index 707b040..e42065d 100644
--- a/functions.php
+++ b/functions.php
@@ -870,7 +870,9 @@ function comment_mail_notify($comment_id){
$comment = get_comment($comment_id);
$parent_id = $comment->comment_parent ? $comment->comment_parent : '';
$spam_confirmed = $comment->comment_approved;
- if(($parent_id != '') && ($spam_confirmed != 'spam')){
+ $mail_notify = akina_option('mail_notify') ? get_comment_meta($parent_id,'mail_notify',false) : false;
+ $admin_notify = akina_option('admin_notify') ? '1' : (get_comment($parent_id)->comment_author_email != get_bloginfo('admin_email') ? '1' : '0');
+ if(($parent_id != '') && ($spam_confirmed != 'spam') && ($admin_notify != '0') && (!$mail_notify)){
$wp_email = $mail_user_name . '@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME']));
$to = trim(get_comment($parent_id)->comment_author_email);
$subject = '你在 [' . get_option("blogname") . '] 的留言有了回应';
@@ -1691,4 +1693,11 @@ if(akina_option('live_search')){
} );
}
+//评论回复
+function sakura_comment_notify($comment_id){
+ if ( !$_POST['mail-notify'] )
+ update_comment_meta($comment_id,'mail_notify','false');
+}
+add_action('comment_post', 'sakura_comment_notify');
+
//code end
diff --git a/options.php b/options.php
index f5df9a7..5c80fde 100644
--- a/options.php
+++ b/options.php
@@ -1054,6 +1054,20 @@ function optionsframework_options() {
'id' => 'mail_user_name',
'std' => 'bibi',
'type' => 'text');
+
+ $options[] = array(
+ 'name' => __('邮件回复通知', 'sakura'),
+ 'desc' => __('WordPress默认会使用邮件通知用户评论收到回复,开启此项允许用户设置自己的评论收到回复时是否使用邮件通知', 'sakura'),
+ 'id' => 'mail_notify',
+ 'std' => '0',
+ 'type' => 'checkbox');
+
+ $options[] = array(
+ 'name' => __('邮件回复通知管理员', 'sakura'),
+ 'desc' => __('当管理员评论收到回复时是否使用邮件通知', 'sakura'),
+ 'id' => 'admin_notify',
+ 'std' => '0',
+ 'type' => 'checkbox');
$options[] = array(
'name' => __('允许私密评论', 'sakura'),