Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

The Honeypot Module

Parent Feed: 

normal difficulty seo task

https://www.drupal.org/project/honeypot

Credit & Thanks

Thank you to:

About the Honeypot Module

No one likes getting those annoying spam-bot submissions via their website’s online forms. It’s a waste of site resources that could be better used by visitors to your site. That’s why we’ve included the Honeypot module in our list.

The honeypot and timestamp methods have historically been effective ways of eliminating spam-bot submissions in online forms. The Honeypot module combines both methods into a single module that will work with all web forms on your Drupal site.

Install and Enable the Honeypot Module

  1. Install the Honeypot module on your server. (See this section for more instructions on installing modules.)
  2. Go to the Extend page: Click Manage > Extend (Coffee: “extend”) or visit https://yourDrupal8site.dev/admin/modules in your browser.

    honeypot module installation
     

  3. Select the checkbox next to “Honeypot” and click the Install button at the bottom of the page.

If necessary, give yourself permissions to use the Honeypot module.

  1. Click Manage > People > Permissions (Coffee: “perm”) or visit https://yourDrupal8site.dev/admin/people/permissions.

    honeypot module permissions
     

  2. Select only the Administer Honeypot checkbox.
     
  3. Click the Save permissions button at the bottom of the page.

Configure the Honeypot module

  1. Go to the Honeypot module admin page by clicking Manage > Content Authoring > Honeypot Configuration (Coffee: “honeypot”) or visit https://yourDrupal8site.dev/admin/config/content/honeypot in your browser.

    honeypot module configuration
     

  2. Select the Protect all forms with Honeypot checkbox.
     
  3. Select the Log blocked form submissions checkbox.
     
  4. Change the Honeypot element name to "mobile". This name could be anything, but you want it to look more like a valid field name.
     
  5. Set the Honeypot time limit to 5.
     
  6. Click the Save configuration button at the bottom of the page.

Adjust Honeypot settings within Webform module (optional)

If you’re using the Webform module, you’ll need to make a slight adjustment to the default settings.

  1. Go to the Webform module admin page by clicking Manage > Structure > Webform (Coffee: “webforms”) or visit https://yourDrupal8site.dev/admin/structure/webform in your browser.
     
  2. Click on the Configuration tab across the top.
     
  3. Scroll to the Third Party Settings section.

    honeypot module configuration third party settings
     

  4. In the Honeypot section, make sure that Protect all webforms with Honeypot checkbox is selected.
     
  5. Leave the Add time restriction to all webforms checkbox unchecked.
     

    Note: We recommend selecting the time restriction setting on a form by form basis. When it is enabled, it  prevents the page on which the form displays will not be cached, and can impact the overall speed of your website if you have a form on every page of your site.

     
  6. Click the Save configuration button.

Using Honeypot within a Webform

After installation, the Honeypot module settings are now available on a form by form basis.

  1. Go to the Webform listing on our site by clicking Manage > Structure > Webforms (coffee: “webforms”) or visit https://yourDrupal8site.dev/admin/structure/webform in your browser.

    honeypot module with web forms
     

  2. Click the Title of the form you would like to edit. This will take you to the form’s page.

    honeypot module webform example
     

  3. Click on the Settings tab. This will take you to that form’s settings under the General sub-tab.

    honeypot module webform settings
     

  4. Scroll down to the Third Party Settings section (normally at the bottom of the page).

    honeypot module webform third party settings
     

  5. Make any changes to the settings and click the Save button at the bottom of the page.
     
  6. Repeat steps 1-5 for each form that needs additional spam protection.
     

WARNING
Enabling the Add time restriction to webform setting will prevent the page on which that form displays from being cached, which will impact the load time of that page. A form that is on every page of your site should not have this setting enabled.

Did you like this walk-through? Please tell your friends about it!

twiter social icon linkedin social icon pinterest social icon

Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web