0
votes

Drupal 7: I need a module to append a contact form to a node of a specific content type. The form should be configurable and permit to send an email with an attachment to the node author. The form should also have a captcha. The email must not be saved in the database.

Does such module exists or do i need to develop it ?

2

2 Answers

1
votes

You should be able to achieve this through the combination of the webform module, CAPTCHA module and a custom module.

Webform defines it's own 'webform' content type, but it also allows you to make other content types webform enabled by visiting 'admin/config/content/webform' and selecting the appropriate content type.

The token module provides node tokens such as nid and title which can be included as a hidden form element, but annoyingly, doesn't include the author as a token.

On the email tab of your webform, it's possible to choose a form component as the email address to send the form results to. I would create a hidden field, leaving the default value blank and then it should be fairly easy to add the node author value to it in a custom module using hook_form_alter (form id can be found by viewing source and looking for the hidden input 'form_id'). You can then use this form component in the email tab to send the results to.

The only thing I can see causing an issue is that there isn't an easy way to stop webform recording the form result in the database - I would imagine this would be achievable in a custom module without too much hassle though.

1
votes

Yop, there is such a module. It's called Webform. Using Webform you can add a block form under certain node type with predefined fields and let send email directly to the node author.

  1. Download and enable Webform 4.x
  2. Create new from, add desired fields
  3. Under E-mails tab for Address use token [current-page:node:author:mail]
  4. In Form settings tab check Available as block
  5. Configure newly enabled block (show only under certain node type + set restricted pages to the node/*/*)
  6. Do tests

You can find printcreens and more detailed instructions here.