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'"); } $email_send_comment="math.zqy@gmail.com"; 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) && !isset($_REQUEST['comment_email_back'])) 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 = "
"; // strip out some chars that might cause issues, and assemble vars $site_name = "阅微堂"; $site_email = "mathzqy@gmail.com"; $charset = get_settings('blog_charset'); $headers = "From: \"{$site_name}\" <{$site_email}>\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-Type: text/html; charset=\"{$charset}\"\n"; $email_send_comment = "Email has sent to ".$to." with subject ".$subject; return wp_mail($to, $subject, $message, $headers); } 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); function get_comment_vote($before, $after) { global $comment; $ans = "{$comment->support}
|{$comment->anti}
";//|report spam";
return $before.$ans.$after;
}
function comment_vote($before, $after) {
echo get_comment_vote($before, $after);
}
?>