Source Code For censored.php
Turn Line Numbers On
<?php
/*
Plugin Name: Censored Comment
Version: 0.1
Plugin URI: http://jfoucher.info/2004/10/06/censored-comment-wordpress-plugin/
Description: Writes a text that shows that a comment has been censored
Author: Jonathan Foucher
Author URI: http://jfoucher.info
This plugin supports Automatic Update : http://wiki.wordpress.org/AutomaticUpdate
Update: http://jfoucher.info/plugin-update.php?p=34
Copyright (c) 2004
Released under the GPL license
http://www.gnu.org/licenses/gpl.txt
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/************************************
** TO TAKE ADVANTAGE OF UPDATE **
** DETECTION, PLEASE CONSIDER **
** MAKING THE FOLLOWING ADDITION **
** TO YOUR WORDPRESS INSTALL **
** **
*************************************
OPEN FOR EDITING : wp-admin/plugins.php
FIND
if ( preg_match("|Version:(.*)|i", $plugin_data, $version) )
$version = $version1?;
else
$version ='';
ADD THE FOLLOWING CODE AFTERWARDS
// BEGIN PLUGIN UPDATE ADD-ON
if ( preg_match("|Update:(.*)|i", $plugin_data, $update) )
{
$update = $update[1];
$update = trim($update);
if ($u = @file("$update")) {
$u = implode('',$u);
$u = trim($u);
$v = trim($version);
if($u != $v){
$updatelink = '<a href="';
$updatelink .= $plugin_uri[1];
$updatelink .= '">';
$updatelink .= '<em><strong>Update Available:</strong> (';
$updatelink .= $u;
$updatelink .= ')</em></a>';
$description[1] .= '<br />';
$description[1] .= $updatelink;
}
else
{
$updatelink = '';
}
}
else{
$updatelink = '';
}
}
else
{ $update ='';}
//END PLUGIN UPDATE ADD-ON
*/
/**********************
Please define the text you would to display above an edited comment
************************/
$censor_text="<p>This post has been censored</p>";
/**********************
Stop editing
************************/
function censor($comment_ID) {
global $content,$comment,$tablecomments,$wpdb,$censor_text;
if (!$censor_text) $censor_text="<p>This post has been censored</p>";
if (!eregi($censor_text,$content)){
$content=$censor_text."\n".$content;
}
$result = $wpdb->query("UPDATE $tablecomments SET comment_content = '$content' WHERE comment_ID = '$comment_ID'");
}
add_filter('edit_comment', 'censor');
?>