ContentBox sports many out of the box comment moderation tools.

From the screenshot you can appreciate all the different tuning you can do for comment moderation:

  • All comments moderated
  • User must have an approved comment to be approved consequentely
  • Auto-deletion of comments that are moderated
  • Moderated keywords (ip addresses, authors, emails, or content)
  • Blocked keywords (ip addresses, authors, emails, or content)

My favorite setting is the auto-deletion of moderated comments. I have never ever ever ever cleaned up spam anymore. I let ContentBox do it every X number of days and I truly appreciate that as it is one less thing to worry about.

Comment Events

As you can see, you have many options when it comes to comment moderation and even blocking. You can also tap into the commenting life-cycle with interception events. Below are all the events you can listen to that deal with comments:

  • cbui_preCommentPost - Before a comment is posted
  • cbui_onCommentPost - After a comment is posted
  • cbui_onCommentModerationRules - After all comment moderation and blocking rules have executed. Your chance to change them or add to them.
  • cbadmin_onCommentStatusUpdate - When the status of a comment is changed
  • cbadmin_preCommentSave - Before a comment is saved by an editor
  • cbadmin_postCommentSave - After a comment is saved by an editor
  • cbadmin_preCommentRemove - Before a comment is removed
  • cbadmin_postCommentRemove - After a comment is removed
  • cbadmin_preCommentRemoveAllModerated - Before all comments moderated comments are auto-deleted
  • cbadmin_postCommentRemoveAllModerated - After all comments moderated comments are auto-deleted
  • cbadmin_preCommentSettingsSave - Before saving comment settings
  • cbadmin_postCommentSettingsSave - After saving comment settings
  • cbadmin_onCommentSettingsNav - On the comment navigation tab
  • cbadmin_onCommentSettingsContent - On the comment content tab

All you have to do is create interceptors or modules that listen to these event functions and you can extend ContentBox your way. Here is a real example from our Akismet moderating module:

function cbui_onCommentModerationRules( event, interceptData, buffer ){
	var oComment = arguments.interceptData.comment;
	var settings = coldbox.getSetting( "modules" )[ "contentbox-akismet" ].settings;
	// check if key is empty? If it is, just return
	if( !len( settings.api_key ) ){

	// verify if spam?
	var isSpam = akismet.isCommentSpam(
		author = oComment.getAuthor(),
		authorURL = oComment.getAuthorURL(),
		authorEmail = oComment.getAuthorEmail(),
		content = oComment.getContent(),
		permalink = cb.linkContent( oComment.getRelatedContent() )

	// if block is setup and comment is spam, then ignore.
	if( settings.block and isSpam ){
		oComment.setIsApproved( false );
		arguments.interceptData.allowSave = false; "Incoming comment is spam and block enabled, ignoring comment.", oComment.getMemento() );
	// else, if spam, mark it
	else if( !settings.block AND isSpam ){
		oComment.setIsApproved( false ); "Incoming comment is spam so moderating it.", oComment.getMemento() );