I'd like to see Mollom Support added so a Captcha can be shown before the email is sent. This way people can't spam the form to send emails. I know you could use the Captcha modules, but I'd prefer to see Mollom added alongside Captcha support.

Comments

jcnventura’s picture

Status: Active » Closed (duplicate)

I know Mollom is quite popular, but it should follow the captcha way, and not require all contrib modules to be changed.. In that sense, this is a duplicate of #245682: Enable use of Mollom for any form.

nancydru’s picture

Status: Closed (duplicate) » Needs review
/**
 * Implementation of hook_nollom_form_list().
 */
function print_mail_mollom_form_list() {
  $forms['print_mail_form'] = array(
    'title' => t('Send by email form'),
    'entity' => 'print_mail',
    );
  return $forms;
}

/**
 * Implementation of hook_mollom_form_info().
 */
function print_mail_mollom_form_info($form_id) {
  switch ($form_id) {
    case 'print_mail_form':
      $form_info = array(
        // Optional: To allow textual analysis of the form values, the form
        // elements needs to be registered individually. The keys are the
        // field keys in $form_state['values']. Sub-keys are noted using "]["
        // as delimiter.
        'elements' => array(
          'fld_from_name' => t('From'),
          'fld_subject' => t('Subject'),
          'txt_message' => t('Your message'),
          ),
      );
      break;
  }
  return $form_info;
}
batigolix’s picture

you can use this code in your custom module to let mollom scan all the fields of the send-to-a-friend-form:

function skfrpaola_mollom_form_list()
{
	$forms['print_mail_form'] = array(
		'title' => t('Send to a friend'),
	);
	return $forms;
}

function skfrpaola_mollom_form_info($form_id)
{
	if($form_id == 'print_mail_form')
	{
		return array(
			'mode' => MOLLOM_MODE_ANALYSIS,
			'elements' => array(
				'fld_from_addr' => t('Sender e-mail'),
				'fld_from_name' => t('Sender name'),
				'txt_to_addrs' => t('Recipients'),
				'fld_subject' => t('Subject'),
				'fld_title' => t('Page to be sent')
			),
			'mapping' => array(
				'post_title' => 'fld_title',
				'author_name' => 'fld_from_name',
				'author_mail' => 'fld_from_addr',
			)
		);
	}
}
safetypin’s picture

Version: 6.x-1.7 » 7.x-1.0-alpha2
Status: Needs review » Needs work

I'm not sure where the problem is occurring, whether Mollom regressed, or this feature isn't working in the alpha. I am using the latest release (not dev) of both Print and Mollom, but I am unable to add the email form to Mollom. Any Ideas?

jcnventura’s picture

Status: Needs work » Fixed

NancyDru, batigolix: thanks for the code..

I've committed a merged version of the above to git.

Status: Fixed » Closed (fixed)

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