Index: mollom.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mollom/mollom.module,v
retrieving revision 1.2.2.175
diff -u -p -r1.2.2.175 mollom.module
--- mollom.module	16 Oct 2010 18:24:54 -0000	1.2.2.175
+++ mollom.module	17 Oct 2010 17:55:06 -0000
@@ -2546,7 +2546,6 @@ function user_mollom_form_info($form_id)
   switch ($form_id) {
     case 'user_register':
       $form_info = array(
-        'mode' => MOLLOM_MODE_CAPTCHA,
         'bypass access' => array('administer users'),
         'moderation callback' => 'user_mollom_form_moderation',
         'mapping' => array(
@@ -2643,3 +2642,28 @@ function contact_mollom_form_info($form_
 /**
  * @} End of "name mollom_contact".
  */
+
+/**
+ * @name mollom_profile Profile module integration for Mollom.
+ * @{
+ */
+
+/**
+ * Implements hook_mollom_form_info_alter().
+ *
+ * Adds profile fields exposed on the user registration form.
+ */
+function profile_mollom_form_info_alter(&$form_info, $form_id) {
+  if ($form_id != 'user_register') {
+    return;
+  }
+  // @see profile_form_profile()
+  $result = db_query("SELECT * FROM {profile_fields} WHERE register = 1 AND type IN ('textfield', 'textarea', 'url')");
+  while ($field = db_fetch_object($result)) {
+    $form_info['elements'][$field->name] = check_plain($field->title);
+  }
+}
+
+/**
+ * @} End of "name mollom_profile".
+ */
Index: tests/mollom.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mollom/tests/mollom.test,v
retrieving revision 1.1.2.66
diff -u -p -r1.1.2.66 mollom.test
--- tests/mollom.test	16 Oct 2010 18:24:54 -0000	1.1.2.66
+++ tests/mollom.test	17 Oct 2010 17:50:24 -0000
@@ -1828,6 +1828,65 @@ class MollomUserFormsTestCase extends Mo
   }
 }
 
+/**
+ * Tests Profile module integration.
+ */
+class MollomProfileFormsTestCase extends MollomWebTestCase {
+  public static function getInfo() {
+    return array(
+      'name' => 'Profile integration',
+      'description' => 'Tests Profile module integration.',
+      'group' => 'Mollom',
+    );
+  }
+
+  function setUp() {
+    parent::setUp(array('profile'));
+  }
+
+  /**
+   * Tests Profile module integration with user registration form.
+   */
+  function testProfileRegistration() {
+    $this->drupalLogin($this->admin_user);
+
+    // Add the three supported profile field types.
+    $fields = array();
+    foreach (array('textfield', 'textarea', 'url') as $type) {
+      $name = 'profile_' . drupal_strtolower($this->randomName());
+      $title = $this->randomString();
+      $fields[$name] = $title;
+      $edit = array(
+        'category' => 'Registration',
+        'title' => $title,
+        'name' => $name,
+        'register' => 1,
+      );
+      $this->drupalPost('admin/user/profile/add/' . $type, $edit, t('Save field'));
+    }
+
+    // Enable text analysis protection for user registration form.
+    $this->setProtection('user_register', MOLLOM_MODE_ANALYSIS);
+    $this->drupalLogout();
+
+    $this->drupalGet('user/register');
+    $this->assertNoCaptchaField();
+
+    $name = $this->randomName();
+    $edit = array(
+      'name' => $name,
+      'mail' => $name . '@example.com',
+    );
+    foreach ($fields as $key => $title) {
+      $edit[$key] = 'unsure';
+    }
+    $this->drupalPost(NULL, $edit, t('Create new account'));
+    $this->postCorrectCaptcha(NULL, array(), t('Create new account'));
+    $this->assertText(t('Your password and further instructions have been sent to your e-mail address.'));
+    $this->assertTrue(user_load(array('name' => $name)), t('New user was found in database.'));
+  }
+}
+
 class MollomCommentFormTestCase extends MollomWebTestCase {
   private $node;
 
