LMCommentModerator SpamCheck API description

By: Leo
On: 13/04-14 09:14
Labels: SpamCheck API, Plugin.

Do you want to make your own comment spam check plugins for the NP_LMCommentModerator plugin? This is the description on the NP_LMCommentModerator SpamCheck API. You can implement this API in your plugin to let the NP_LMCommentModerator use your plugin for comment spam checks.

NP_LMCommentModerator SpamCheck API overview

The NP_LMCommentModerator SpamCheck API makes it possible to extend the comment spam handling abilities of the NP_LMCommentModerator plugin by creating Nucleus plugins that subscribe to the spam check events triggered by the NP_LMCommentModerator plugin.

The NP_LMCommentModerator plugin implements a modified subset of the Nucleus CMS SpamCheck API. The reason for using a modified version is that the Nucleus CMS SpamCheck API data structures are missing some data that is needed by the spam handling in the NP_LMCommentModerator plugin.

A spam check plugin can categorize a comment in 3 different categories:

  • Spam - Comments that the spam check plugin is certain are spam is categorized as Spam.
  • Ham - Comments that the spam check plugin is certain are genuine comments is categorized as Ham.
  • Undecided - Comments that the spam check plugin can't categorize as Ham or Spam is categorized as Undecided.

The LMCommentModerator_SpamCheck event

Spam check plugins must implement and subscribe to the LMCommentModerator_SpamCheck event. The $data parameter for this event contains a spamcheck member. It is an associated array which contain data that can be used by the spam check plugin. The members of this associated array are:

  • type - Will always be comment.
  • commentid - The commentid of the comment to be spam checked.
  • itemid - The itemid of the item the comment to be spam checked belongs to.
  • memberid - The memberid of the member posting the comment. Will be false if the author is not a member.
  • body - The raw body of the comment to be spam checked.
  • author - The name of the comment author.
  • email - The email address of the comment author.
  • url - The URL to the website of the comment author.
  • ip - The IP-address that was used to post the comment.
  • result - The result of the spam check is returned here. Set to H if the spam plugin categorize the comment as Ham. Set to S if the spam plugin categorize the comment as Spam. Do not update this attribute if the spam plugin classifies the comment as Undecided.
  • plugin - If the result is set, is the name of the spam check plugin returned here.
  • message - If the result is set, is a reason for the categorization returned here.

If the result attribute is already set in the spamcheck array when the event is triggered in a spam check plugin must the spam check plugin ignore the spam check and return without updating any result attributes.

If no spam check plugins categorize the comment as Ham or Spam, will the NP_LMCommentModerator plugin assign the Manual Moderation category the comment.

For an example of how to implement this event, see the NP_LMCommentModerator plugin. It uses this event to spam check comments against the filters used by the NP_LMCommentModerator plugin.

The LMCommentModerator_SpamMark event

Spam check plugins can implement and subscribe to the LMCommentModerator_SpamMark event if they want to be notified when a comment moderator categorizes a comment as Spam or Ham. The purpose for this event is for spam check plugins to be able to learn from the categorizing done by comment moderators.

The $data parameter for this event contains a spammark member. It is an associated array which contain data that can be used by the spam check plugin. The members of this associated array are:

  • type - Will always be comment.
  • commentid - The commentid of the comment.
  • itemid - The itemid of the item the comment.
  • memberid - The memberid of the member posting the comment. Will be false if the author is not a member.
  • body - The raw body of the comment.
  • author - The name of the comment author.
  • email - The email address of the comment author.
  • url - The URL to the website of the comment author.
  • ip - The IP-address that was used to post the comment.
  • result - If the comment has been categorized as Ham is it set to H. If the comment has been categorized as Spam is it set to S.

For an example of how to implement this event, see the NP_LMCommentModerator plugin. It uses this event to update the filters used by the NP_LMCommentModerator plugin.


Add Comment

Spam and off topic comments will be deleted.

Allowed BBCode:[b] [i] [u] [s] [color=] [size=] [quote] [code] [email] [url]

Blog Filter

Filtered by labels: None.

Search site