I'm involved in the development with the Janrain Engage module (http://drupal.org/project/rpx) and noticed that when Mollom is also enabled on the user registration form, then the word verification always fails the first time around (since the Janrain Engage authentication widget doesn't have a Mollom captcha built in).

Is there any way currently to programmatically bypass the Mollom check if users are authenticating with a verified third-party service like Janrain Engage?

Thanks,
Ben

CommentFileSizeAuthor
#4 mollom.form-alter.4.patch1.18 KBsun

Comments

sun’s picture

You should already be able to do this by adjusting

$form_state['mollom']['require_analysis'] = TRUE|FALSE
$form_state['mollom']['require_captcha'] = TRUE|FALSE

Note that these values are initialized only once. Therefore, if you intend to re-enable the Mollom validation in a subsequent form submission/rebuild, then you should backup the original values somewhere else in $form_state and restore them.

Also, you should account for both, since users might have chosen to protect the form via text analysis instead of a CAPTCHA, which is only possible if the registration form contains additional text fields besides name and e-mail.

sun’s picture

Status: Active » Fixed

Marking this as fixed, unless #1 doesn't work for you.

geokat’s picture

Status: Fixed » Active

Hi sun,

Thanks for your reply. #1 seems to work, but it triggers a bunch of
notices:

Notice: Undefined index: require_moderation in mollom_validate_post() (line 1629 of /home/geo/lib/d7/sites/all/modules/mollom/mollom.module).
Notice: Undefined index: response in mollom_form_submit() (line 1683 of /home/geo/lib/d7/sites/all/modules/mollom/mollom.module).
Notice: Undefined index: require_moderation in mollom_form_submit() (line 1688 of /home/geo/lib/d7/sites/all/modules/mollom/mollom.module).

To test this, I wrote a simple hook_form_FORM_ID_alter()
implementation (my_module_form_user_register_form_alter()) which does
nothing but this:

$form_state['mollom']['require_analysis'] = FALSE;
$form_state['mollom']['require_captcha'] = FALSE;

Is there anything I might have overlooked? I use mollom 7.x-1.0.

Thanks,
George

sun’s picture

Status: Active » Needs review
StatusFileSize
new1.18 KB

Can you try whether attached patch resolves the PHP notices?

sun’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs backport to D6

I'm confident that this patch will resolve the issue.

Problem space being that hook_form_alter() is invoked before the #process callback mollom_process_mollom(), so programmatically overriding the 'require_analysis' or 'require_captcha' flags in hook_form_alter() leads to all other keys in $form_state['mollom'] being undefined.

sun’s picture

Title: Create ability to bypass mollom check programmatically » Bypassing Mollom checks programmatically leads to PHP notices
Category: support » bug
dries’s picture

I tried to apply this patch but it failed:

deimos:mollom dries$ git apply ../f.p 
error: patch failed: mollom.module:1333
error: mollom.module: patch does not apply

I'll retest this patch to make sure it is not my setup.

dries’s picture

#4: mollom.form-alter.4.patch queued for re-testing.

dries’s picture

Status: Reviewed & tested by the community » Patch (to be ported)

Ah, I was trying to apply this against the wrong branch. Committed it to the 'master' branch. Should probably be ported to the other branches.

sun’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Status: Patch (to be ported) » Fixed

Thanks for reporting, reviewing, and testing! Committed to 6.x-1.x.

A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit a973918 on master, fai6, 8.x-2.x, fbajs, actions by Dries:
    - Patch #1150516 by sun | BenK: bypassing Mollom checks programmatically...

  • Commit a973918 on master, fai6, 8.x-2.x, fbajs, actions by Dries:
    - Patch #1150516 by sun | BenK: bypassing Mollom checks programmatically...