Integrate with spam module (http://drupal.org/project/spam)

Check all the textareas for spam during form validation and if one triggers,
set a form error and inject a CAPTCHA as a second step to the form.

I know Mollom does something similar, but Mollom is way overkill, because it requires an account on an external site, and has trusted users, which we don't really need etc, etc. AND Mollom cannot be used with any form like CAPTCHA can.

Comments

soxofaan’s picture

I don't know the spam module very well. I used it in the past, but it seems to be evolved quite a bit since then.

It certainly would be possible, but for the moment I don't have time to investigate/implement this.
Things to take into consideration: should the integration be implemented in the spam module or in the CAPTCHA module? For the moment I am inclined to say in the spam module, but that is just a first impression.

AND Mollom cannot be used with any form like CAPTCHA can.

they are working on that: #245682: Enable use of Mollom for any form

treksler’s picture

I looked at the CAPTCHA modulae a bit .. looks like there is currently no way to allow another module to use code from the CAPTCHA module to inject CAPTCHAs on the fly.. (the CAPTCHA module seems to assume all captcha points are stored in the database)

So, I am thinking that if I refactored CAPTCHA to allow any module to inject CAPTCHAs on the fly, I could put the necessary logic into the spam module....

soxofaan’s picture

I looked at the CAPTCHA modulae a bit .. looks like there is currently no way to allow another module to use code from the CAPTCHA module to inject CAPTCHAs on the fly.. (the CAPTCHA module seems to assume all captcha points are stored in the database)

This is true for CAPTCHA 6.x-1.x and earlier.
But the CAPTCHA branch 6.x-2.x is the result of major refactoring to make it possible for other modules to inject CAPTCHAs in the way they want. CAPTCHA 6.x-2.x defines a CAPTCHA element that can be added to forms just like text fields an option lists.
The core CAPTCHA module just provides a basic admin interface that indeed stores its captcha points in its database table.

Adding a CAPTCHA to a form is just as easy as:

<?php
$form
['my_captcha'] = array(
 
'#type' => 'captcha',
);
?>

e.g. also see #536274: Show Captcha After X Unsuccessful Attempts

soxofaan’s picture

Status:Active» Closed (duplicate)

I made a separate documentation thread about this feature: #743056: Document how to add a CAPTCHA programmatically
I think it's best to mark this one as a duplicate