Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7816833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:01:07+00:00 2026-06-02T06:01:07+00:00

I thought I had this one sorted but I have run into a snag.

  • 0

I thought I had this one sorted but I have run into a snag. I want to add a ‘Honey Pot’ to the customer registration form, for those unfamiliar this technique involves hiding a text input using CSS and assumes that the average bot will want to fill it in. Humans however, will not see the field so it needs to validate as empty.

In Magento I created a new module, added the following to the config.xml:

<global>
    <fieldsets>
        <customer_account>
            <honeytrap><create>1</create><update>1</update></honeytrap>
        </customer_account>
    </fieldsets>
    <models>
        <customer>
            <rewrite>
                <customer>MyStore_Honeytrap_Model_Customer</customer>
            </rewrite>
        </customer>
    </models>
</global>

I then added a little bit extra to the validate function to check the field is empty. This all correct as far as I can see but at about line 278 in the AccountController.php the extractData() discards the input field from the post data in the request. I’m still very new to Magento so hoping to learn something here too but how do I prevent the field being stripped out of the post by extractData()?

Guess I just want to know what I’m missing, I’ve read a few posts on the internet regarding adding a custom field so as far as I know this should be working but maybe I’ve missed something out as I didn’t include the Entity setup since I don’t need to save this field in the database it’s purely to validate the registration is from a human (as much as possible).

Thanks for any help, I’m sure it’s probably something ridiculous that I’ve missed.

EDIT: Thanks to @gordon-knoppe pointer on using the event:

public function check_trap(Varien_Event_Observer $observer)
{
    $event = $observer->getEvent();
    $post = $event->getControllerAction()->getRequest()->getPost();

    // Check Honeytrap is empty
    if (Zend_Validate::is( trim($post['fname']) , 'NotEmpty')) 
    {
        $customerHelper = Mage::helper('customer');
        $error = $customerHelper->__('A problem has occured with your registration.');
        Mage::getModel('customer/session')->addError($error);

        Mage::app()->getResponse()
            ->setRedirect(Mage::getUrl('customer/account', array('_secure' => true)))
            ->sendResponse();
        exit;
    }
}

With this in the config.xml:

    <events>
        <controller_action_predispatch_customer_account_createpost>
            <observers>
                <mystore_honeytrap_observer>
                    <type>singleton</type>
                    <class>Mystore_Honeytrap_Model_Observer</class>
                    <method>check_trap</method>
                </mystore_honeytrap_observer>
            </observers>
        </controller_action_predispatch_customer_account_createpost>
    </events>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T06:01:08+00:00Added an answer on June 2, 2026 at 6:01 am

    A more detached way to handle this could be to register an observer for before the relevant controller action (controller_action_predispatch_*) to detect whether your form field has been populated and, if so, redirect them out to prevent the native action from ever processing the request.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I thought I had this one pretty good, but I just keep running into
OK. So I thought I had this licked ... but now .... I have
I thought I had this figured out but it turns out I'm just deleting
Alright, I thought I had this whole setTimeout thing perfect but I seem to
I thought I had this all figured out, but I'm hitting a brick wall.
I thought I had fixed this on Friday through a type correction, but I
I thought I had this all figured out, but now that I'm writing a
I thought I had answered this question before thanks to StackOverFlow, but I hastily
Ok, I thought I had this but I am not getting the results that
Just when I thought I had this one cinched, I realized that I can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.