PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Any way to NOT capture IP Address on certain forms?

  1. SoundsGood
    Member

    Hi,

    Currently the IP Address of a user is captured when they submit a form. Normally this is a good thing, but I've got a situation (with just one form) where it CANNOT be collected for legal reasons. So...

    Is there any way to NOT capture the IP Address on just ONE form on a site? Again, this is not for all the forms on the site, just one in particular.

    Thanks...

    Posted 12 years ago on Wednesday March 28, 2012 | Permalink
  2. dnb
    Member

    Hi-
    I asked what I think is a similar question a while back and gave a proposal for an answer in my posting that I haven't tried yet (was waiting to hear back from support). It may be helpful to you. Please let me know if it works out for you.

    -- dNb

    Posted 12 years ago on Friday March 30, 2012 | Permalink
  3. SoundsGood
    Member

    Thanks dNb, but I'm not a programmer so I'm really hoping someone from GravityForms can help with this.

    Here's the thing: the site is for a police department. They need one form that DOES capture the ip address and one form that DOES NOT capture. Apparently it's illegal to capture ip addresses on anonymous forms, and since they're the police... well, you know.

    Anyone ??

    Thanks.

    Posted 12 years ago on Tuesday April 3, 2012 | Permalink
  4. Not sure if there is a way to not have the IP come through, however it probably can be deleted using the after_submission hook:

    http://www.gravityhelp.com/documentation/page/Gform_after_submission

    Posted 12 years ago on Thursday April 5, 2012 | Permalink
  5. SoundsGood
    Member

    Thanks, but I don't have a clue how to do that. I'm bummed (and surprised, frankly) that we can't just shut off the IP collection if we want to.

    Can someone recommend another easy to use form submission tool that does NOT send the IP address? I've gotta get this done.

    Thanks!

    Posted 12 years ago on Monday April 9, 2012 | Permalink
  6. The following code snippet should do the trick. Just make sure to replace the form ID with your actual value (see Note).

    add_action('gform_after_submission', 'remove_ip', 10, 2);
    function remove_ip($entry, $form) {
        global $wpdb;
    
        //NOTE: replace 79 below with your actual form ID. The form you don't want the IP's to be recorded
        if($form["id"] == 79){
            //removing IP from entry table
            $wpdb->query($wpdb->prepare("UPDATE {$wpdb->prefix}rg_lead SET ip='' WHERE id=%d", $entry["id"]));
        }
    }
    Posted 12 years ago on Monday April 9, 2012 | Permalink
  7. SoundsGood
    Member

    Thank you Alex.

    Posted 12 years ago on Tuesday April 10, 2012 | Permalink

This topic has been resolved and has been closed to new replies.