Designed to
delight
we design & develop
exceptional Drupal websites
The Beatles
 
Designed to
inform
we design & develop
exceptional Drupal websites
 
Designed to
unite
we design & develop
exceptional Drupal websites
SGI UK
 
Designed to
inform
we design & develop
exceptional Drupal websites
 
Designed to
delight
we design & develop
exceptional Drupal websites
 
Designed to
entice
we design & develop
exceptional Drupal websites
 
Designed to
engage
we design & develop
exceptional Drupal websites
 
Designed to
convert
we design & develop
exceptional Drupal websites
 
Designed to
motivate
we design & develop
exceptional Drupal websites
 
Designed to
delight
we design & develop
exceptional Drupal websites
 
Designed to
influence
we design & develop
exceptional Drupal websites
 
Designed to
delight
we design & develop
exceptional Drupal websites
 
Designed to
inform
we design & develop
exceptional Drupal websites
 
Designed to
convert
we design & develop
exceptional Drupal websites
Clovis Canopies
 
Designed to
network
we design & develop
exceptional Drupal websites
 
Designed to
motivate
we design & develop
exceptional Drupal websites
 

Adding Mollom Captcha Protection to Form API custom forms

Mollom is a great spam and bot protection tool for Drupal that protects Drupal's core forms and Webforms.

But what about custom forms we create with Drupal's Form API?

Thanks to Mollom's own api this is simple. Here's a snippet that we recently used to protect a custom password recovery form: -

<?php
function example_ibix_mollom_form_list() {
 
$forms['example_form_id'] = array(
   
'title' => t('Example Friendly Form Name'),
  );
  return
$forms;
}

function
example_mollom_form_info($form_id) {
    switch (
$form_id) {
        case
'example_form_id':
           
$form_info = array(
               
'mode' => MOLLOM_MODE_CAPTCHA,
            );
            return
$form_info;
            break;
    }
}
?>

Once we implement these hooks our form is displayed in the list of forms on Mollom's protection pages.

It's easy to add more options and change Mollom's mode too. Take a look at the mollom.api.php file included in mollom's module to see the full implentation.