Hi. I'm not sure if this is the right place to do this but I'll give it a try. In the past few days I've been developing a patch to integrate mollom module with simplenews subscription block form following the API instructions, with no success. I successfully managed to get mollom module to take simplenews block forms in account (admin), but after I configure them it still doesn't show the captcha image or any other kind of verification and simply allows the form to be submitted without any kind of protection.
I don't know if there's someone currently working on this feature, but even if there's not I'd like to get some guidance regarding this feature in order to complete my patch.
So far I included simplenews_mollom_form_list(), simplenews_mollom_form_info() and simplenews_mollom_form_info_alter() functions. I even read the test function code included in mollom module to try to figure out what I'm missing, but my only guessing is that it fails because I'm dealing with a block form and not a "normal" form per se.
Thanks in advance for any information and/or help you can give me in this matter!

CommentFileSizeAuthor
#13 1874072-simplenews-12.patch1.02 KBLukas von Blarer
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

wheck’s picture

Hi again! Well it turned out that the problem was that the form id of the block was saved using hyphen instead of underscores into the db, and that's why mollom module couldn't find it!! After fixing that, it took me a while to figure out I had to empty mollom module's cache, but at the end I did and the captcha image was finally rendered into the block :D. Now the problem is that when I submit the form, it gives me Call to undefined function simplenews_block_form_validate(), and when I print $form and $form_state it shows nothing. From all the code reading I've done so far, I got that mollom module works for node-based forms, but if I'm putting all the information required in my block form it should work, right? Seriously isn't there anyone who can help me?

miccelito’s picture

If you wanna add some spam protection to simplenews input.form-text field (for anonymous users) you could use Botcha http://drupal.org/project/botcha. It lets you add the form id as you describe above

sun’s picture

Title: Mollom module integration with simplenews » Simplenews integration/support
Version: 7.x-2.3 » 7.x-2.x-dev
Status: Active » Postponed (maintainer needs more info)

Isn't Simplenews based on nodes?

All node types can be protected by Mollom already.

wheck’s picture

Hi! Something happened and I failed to get email notification of your answers, sorry about that. I was trying to add mollom support to a simplenews block form, not to a node per se. When I tried to do so, the blocks I hade on my site didn't even show up in mollom's settings page.
Regarding miccelito's comment, I'll definitely give botcha a try! thanks :D!

wheck’s picture

Definitely didn't make it. I added the form id and saved it, but the captcha doesn't show. I'm still checking botcha settings hoping I missed something, but I'm starting to think you just can't protect forms contained in blocks. Nevertheless I'm still not giving up since in botcha's default settings, user block form appears listed as protected, so there may still be hope for those poor block-embbeded forms!

wheck’s picture

Neh, I'm giving up on this, any new ideas are totally welcomed, I'm feeling really frustrated here...

miccelito’s picture

Install Botcha https://drupal.org/project/botcha i.e Botcha 7.x-3.2.
Enable the module.
Go to admin/config/people/botcha/form.
Click 'Add BOTCHA protection to form' link.
Add the simplenews block form id (would be something like 'simplenews_block_form_**' where ** is the number rendered for the current simplenews block).
Your block should now be protected.

sun’s picture

Unfortunately, it's unclear what questions are unresolved here. The last stated error was:

Call to undefined function simplenews_block_form_validate()

However, that is not relevant to the Mollom integration. The error message indicates that the form constructor registered a form validation callback simplenews_block_form_validate(), but in the request that actually invokes the form validation, the function is not loaded and thus unknown to the system.

Most often, this is caused by form constructors that are dynamically loading additional code from other PHP include files, whereas the form constructor function is not necessarily re-executed when a form is validated. In turn, the form validation callback function is registered, but not loaded.

lionheart8’s picture

I am using simplenews, I am not a coder ... have always used mollom, which has always faithfully blocked submissions, including a recent onslaught of 0ver 24000 attempted submissions on a single day, for what is apparently a small site.

I would very much want to include simplenews forms, but none appears on the form addition page.
Could you please consider adding it to the forms it protects? I am sure many folks would profit from this as simplenews is widely used.

Thank you ...

Jochen Wendebaum’s picture

Issue summary: View changes

It is necessary for mollom to also work on forms in blocks, as the simplenews subscribe block.

Is this in the roadmap?

caicedo’s picture

Simplenews uses either a block of a form to allow people to subscribe. For some reason the form does not appear in the list of forms that Mollom can protect. I think having protection on the block would be nice. Adding the subscription form to the list that Molom identifies is at least a first step.

Lukas von Blarer’s picture

Status: Postponed (maintainer needs more info) » Needs work

This does the trick for the multisubscription form. Adding support for the per newsletter category forms is not hard..

<?php
/*
 * Implements hook_mollom_form_list()
 */
function simplenews_mollom_form_list() {
  $forms['simplenews_subscriptions_multi_block_form'] = array(
    'title' => t('Simplenews multi subscription form')
  );
  return $forms;
}

/**
 * Implements hook_mollom_form_info().
 */
function simplenews_mollom_form_info($form_id) {
  switch ($form_id) {
    case 'simplenews_subscriptions_multi_block_form':
      $form_info = array(
        'mode' => MOLLOM_MODE_ANALYSIS,
        'elements' => array(
        ),
        'mapping' => array(
          'author_mail' => 'mail',
        ),
      );
      return $form_info;
  }
}
?>
Lukas von Blarer’s picture

Status: Needs work » Needs review
FileSize
1.02 KB

Well, actually I could provide a patch for this directly :)

Status: Needs review » Needs work

The last submitted patch, 13: 1874072-simplenews-12.patch, failed testing.

Status: Needs work » Needs review

eshta queued 13: 1874072-simplenews-12.patch for re-testing.

eshta’s picture

The last test failure was due to an unrelated issue. I've just submitted this for re-test.

eshta’s picture

Status: Needs review » Closed (won't fix)
Related issues: +#2371353: Add support for Mollom

I know some time has passed here. It seems to me that the Mollom hooks really belong within the simplenews module. That way as things change on how the content is structured, they can be appropriately updated. I have taken the patch that was submitted here and used it to create a new issue in their queue. I'm happy to help as far as advising how to use the API and I'm set as a watcher on the ticket.

https://www.drupal.org/node/2371353