Only require comment approval when an image is attached


You can create a module to do this by using the hook_comment_presave hook. If your module name is playx, then try this code:

function playx_comment_presave($comment) {
  if(strstr($comment->comment_body[$comment->language][0]['value'], '<img')){
   $comment->status = 0;

I got this working using the Mollom module.

In Mollom's configuration, you can enable spam filtering and set up your own blacklist terms for the spam filter. I created blacklist terms for <img and "media-image" (TinyMCE's encoded image class). Then I told Mollom to "Retain the post for manual moderation" if it gets detected as spam.

Tags: Comments

Similar questions

admin/content/comment/approval -> 410 Gone error (linked from content -> comments -> unapproved comments)
I have no idea when this happened (I've been trying to fix Mollom + PostgreSQL, to the point where I tried, and removed, some core patches), but when I go to Content / Comments / Unapproved Comments (which leads to admin/content/comment/approval) I get a 410 Gone error. Was this supposed to be a view? How does one recreate such core views? Is the l...
Anonymous users skip comment approval but they shouldn't
In my drupal 8.6.1 news blog anonymous users can skip comment approval althouth permissions are set to not skip. I rebuilt the permissions but nothing changed. Also in comments page I see that some anonymous users are linked to an anonymous user account with id = 0 ! My site is not hacked and I can't understand what is going on. Check this image! I...
How can i insert a comment form between parent comment and comment replies?
i want hide the comment reply,when user click the “2 replies” button will slide the replies,after slide out the replies i also want to show a comment form that people can post a reply easily. anyone can help? Thank you so much.
Error: Content type X has Drupal core comment comment type, but is a comment type itself for the following content types
I'm using Node Comments module and I get a strange error in Status Report: Node Comments Content type Answer has Drupal core comment comment type, but is a comment type itself for the following content types: Forum topic However, in the content type settings of 'Answer', this setting is disabled: th...
How to change the comment link text "Login or register to post comment" to be shorter eg " comment" in drupal
I have created a Q&A type using Create Content in drupal. I have created a new content name Ask and Answer. Until this i don't have any issues. Now problem is i have enabled comments in content type. In this case i need to change the "Add new comment" or similar links related to comments as "Answer" without changing the core comment module. How...
Only create taxonomy terms on node approval?
Right now nodes on my site are unpublished by default because I want to manually approve user submitted content. How can I make it so that user submitted taxonomy terms are not created until I manually approve the corresponding node?

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.