From 0c1e3856b675ad2e8b5d3afaed237899ee3dd33c Mon Sep 17 00:00:00 2001 From: saxmatt Date: Thu, 25 Mar 2004 20:18:20 +0000 Subject: [PATCH] Additional plugin API hooks, extending moderation scheme to more fully cover trackbacks and pingbacks, cleanup of XML-RPC file. git-svn-id: http://svn.automattic.com/wordpress/trunk@1012 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/post.php | 6 ++++-- wp-comments-post.php | 2 ++ wp-includes/functions.php | 1 + wp-trackback.php | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/wp-admin/post.php b/wp-admin/post.php index 1c7dee22f..c3c56aa29 100644 --- a/wp-admin/post.php +++ b/wp-admin/post.php @@ -378,6 +378,7 @@ switch($action) { pingBlogs($blog_ID); } // end if moving from draft/private to published if ($post_status == 'publish') { + do_action('publish_post', $post_ID); // Trackback time. $to_ping = trim($wpdb->get_var("SELECT to_ping FROM $tableposts WHERE ID = $post_ID")); $pinged = trim($wpdb->get_var("SELECT pinged FROM $tableposts WHERE ID = $post_ID")); @@ -407,6 +408,7 @@ switch($action) { $location = 'post.php'; } header ('Location: ' . $location); + do_action('edit_post', $post_ID); break; case 'delete': @@ -448,7 +450,7 @@ switch($action) { $sendback = $HTTP_SERVER_VARS['HTTP_REFERER']; if (strstr($sendback, 'post.php')) $sendback = get_settings('siteurl') .'/wp-admin/post.php'; header ('Location: ' . $sendback); - + do_action('delete_post', $post_ID); break; case 'editcomment': @@ -676,7 +678,7 @@ switch($action) { $referredby = $HTTP_POST_VARS['referredby']; if (!empty($referredby)) header('Location: ' . $referredby); else header ("Location: edit.php?p=$comment_post_ID&c=1#comments"); - + do_action('edit_comment', $post_ID); break; default: diff --git a/wp-comments-post.php b/wp-comments-post.php index 14b2f44f2..27b484f27 100644 --- a/wp-comments-post.php +++ b/wp-comments-post.php @@ -100,6 +100,8 @@ if ($ok) { // if there was no comment from this IP in the last 10 seconds wp_notify_postauthor($comment_ID, 'comment'); } + do_action('comment_post', $comment_ID); + if ($email == '') $email = ' '; // this to make sure a cookie is set for 'no email' diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 2e6bd3a40..3d1e1be22 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1567,6 +1567,7 @@ function get_posts($args) { } function check_comment($author, $email, $url, $comment, $user_ip) { + if (1 == get_settings('comment_moderation')) return false; $words = explode("\n", get_settings('moderation_keys') ); foreach ($words as $word) { $word = trim($word); diff --git a/wp-trackback.php b/wp-trackback.php index 76367eb6d..e41de3ad1 100644 --- a/wp-trackback.php +++ b/wp-trackback.php @@ -86,6 +86,7 @@ if ((strlen(''.$tb_id)) && (empty($HTTP_GET_VARS['__mode'])) && (strlen(''.$tb_u if (get_settings('comments_notify')) wp_notify_postauthor($comment_ID, 'trackback'); trackback_response(0); + do_action('trackback_post', $comment_ID); } } ?> \ No newline at end of file