Block Commenter is a module that blocks the spammer permanently from commenting thus prevents spam comments and posts which degrades the value of the posted content.
This is a simple drupal 7 module which allows Drupal site administrators to block the registered users from commenting on nodes of selected content type.
1. Enter a comma seperated list of registered users to be blocked – to implement this, the module uses '#autocomplete_path' attribute of a field which calls a menu that returns a drupal_json_output().
2. Select what needs to be done with the existing comments of above blocked users.
- Leave as it is.
- Unpublish – to implement this, the module uses comment_unpublish_action(NULL, array('cid' => $record->cid)) method, which sets the status of given cid to 0
- Delete - to implement this, the module uses comment_delete_multiple($cids) method, which delete all the given cids and corresponding reply's.
3. Select the node content type corresponding to which you want to block the selected users from commenting.
At last to block the comment form for the selected user and content type in the page full view, the module uses $node->comment = 0;
You can learn more about Block Commenter at the Block Commenter project page.