TCC’s Moderate Specific Posts plugin
Louie Alfred Gomez asked a question on the WordPress Hacker’s list yesterday about the best way to moderate all comments on specific blog posts. He was hacking the core WordPress code, which all of you who have just updated know is a bad idea.
I whipped out this plugin to show him an alternate solution. If anyone else finds they might need this, I’ll add a configuration screen and turn it into a zip file
Here’s the source as is:
PHP:
-
<?php
-
/*
-
Plugin Name: TCC’s Moderate Specific Posts
-
Plugin URI: http://www.thecodecave.com/articlecategory/plugins/
-
Plugin File Name: TCC_ModeratedPosts.php
-
Description: Throw the comments on specific posts into moderation.
-
Author: Brian Layman
-
Version: 0.1
-
Author URI: http://www.thecodecave.com/
-
*/
-
-
// **********************************************************************
-
// Defined Constants
-
// **********************************************************************
-
-
// This define would be replaced if a UI was added to the plugin. (See v.0.2)
-
// If you don’t want spam to be filtered out with Akismet, change the this to 1.
-
-
-
// **********************************************************************
-
// Pluggable Function replacements
-
// **********************************************************************
-
-
function tcc_premoderate_specific_posts($commentdata) {
-
global $auto_comment_approved;
-
-
$auto_comment_approved = ‘moderated_post’;
-
return $commentdata;
-
}
-
-
function tcc_moderate_specific_posts($approved) {
-
// Called from within wp_allow_comment
-
global $auto_comment_approved;
-
if ( ‘moderated_post’ == $auto_comment_approved )
-
$approved = 0;
-
return $approved;
-
}
-
-
// **********************************************************************
-
// Initialization
-
// **********************************************************************
-
-
// Sets the timing of the action to either before or after Akismet add_action(’preprocess_comment’, ‘tcc_premoderate_specific_posts’, MODERATION_PRIORITY);
-
-
// Does the actual deletion and triggers the subsequent notification of the moderators add_filter(’pre_comment_approved’, ‘tcc_moderate_specific_posts’, 1);
-
-
?>















