get_col("DESC $wpdb->comments", 0) as $column) { if ($column == $column_name) { return true; } } $q = $wpdb->query("ALTER TABLE $wpdb->comments ADD COLUMN comment_reply_ID INT NOT NULL DEFAULT 0;"); foreach ($wpdb->get_col("DESC $wpdb->comments", 0) as $column) { if ($column == $column_name) { return true; } } return false; } function commentreply_load_scripts() { echo ''; } function add_reply_id_formfield() { echo ''; } function add_reply_ID($id) { global $wpdb; $reply_id = mysql_escape_string($_REQUEST['comment_reply_ID']); $q = $wpdb->query("UPDATE $wpdb->comments SET comment_reply_ID='$reply_id' WHERE comment_ID='$id'"); } // choose your comment comtemplate function change_comments_template($file) { return ABSPATH . "/wp-content/plugins/ajaxcomment/comments.php"; } add_action('wp_head','reply_column_checker'); add_action('wp_head','commentreply_load_scripts'); // add_action('edit_post', 'add_reply_id', 100); add_action('comment_post','add_reply_id'); add_filter('comments_template', change_comments_template); // the function below send email notice when you with specific email as $email_send_comment reply some comments. // if you want to actitive this function, fill in $email_send_comment with your email and uncomment add_action line. $email_send_comment=""; // add_action('comment_post', 'email_back'); function email_back($id) { global $wpdb, $email_send_comment; $reply_id = mysql_escape_string($_REQUEST['comment_reply_ID']); $post_id = mysql_escape_string($_REQUEST['comment_post_ID']); if ($reply_id == 0 || $_REQUEST["email"]!=$email_send_comment) return; $comment = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_ID='$id' LIMIT 0, 1"); $reply_comment = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_ID='$reply_id' LIMIT 0, 1"); $post = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE ID='$post_id' LIMIT 0, 1"); $comment = $comment[0]; $reply_comment = $reply_comment[0]; $post = $post[0]; $title = $post->post_title; $author = $reply_comment->comment_author; $url = get_permalink($post_id); $to = $reply_comment->comment_author_email; if ($to == "") return; $subject = "作者回复了你在[".get_bloginfo()."]'".$title."'的留言"; $date = mysql2date('Y.m.d H:i', $reply_comment->comment_date); $message = "$reply_id;$id;$post_id;
Dear $author:
{$comment->comment_content}
{$reply_comment->comment_content}