DC FreeForm GeoIP Extension
Fresh from the coding factory comes a new, handy extension. Ever wondered where a visitor who just filled out a FreeForm on your ExpressionEngine website came from? Now you can stop wondering and start spying!
Download DC FreeForm GeoIP Extension 1.0.3
Overview
If you've ever come across the challenge to create a form with more than the default contact form fields in EE, chances are very good you know Solspaces's FreeForm already. For all of you who don't this would be the ideal time to have a look at the FreeForm product website as well as the documentation page of this EE module.
In Short: with FreeForm you can build completely customized forms, managing the posted entries and user or administrator emails all from ExpressionEngine's control panel.
What FreeForm does not support out of the box is providing information about where the visitor who just filled out your form comes from or what his IP address is. Sure, you can define an IP field in FreeForm and a hidden input field in your form that will pass the IP through the form so that you can include it in your admin emails. With this extension, you have the possibility to either automatically append not only the IP address of your visitor, but also the location data belonging to that IP address.
You can also use the {ip_location_data} in those admin email templates you want to have location data included while turning of the automatically append feature.
Currently, this extension uses the free geolocate API from http://www.hostip.info to retrieve the location data for an IP address. However, we've added a hook for developers to be able to use another service if they wish.

Requirements
- You need to have the Solspace Freeform
2.6.62.7.1 installed, this extension won't work with any older version of FreeForm. - As of this writing, Solspace does not provide the appropriate hooks for changing the contents of the email being sent to the admin in their latest FreeForm release. Solspace has however released a bug fix for this, you'll need to grab the mod.freeform.php file from this post and overwrite the one from the official release.
- CURL for PHP enabled
Installation
- Download DC FreeForm GeoIP Extension.
- Unpack the archive contents to your Desktop or to a location of your choice on your hard-drive.
- Copy the
extensions/ext.dc_freeform_geoip.phpfile to your/system/extensionsdirectory. - Copy the
language/english/lang.dc_freeform_geoip.phpfile to your/system/language/englishdirectory (or duplicate and modify for any other language).
Activation & Settings
This extension does not have any special activation requirements (except for the requirements in order for it to run). Follow these steps to activate the extension in your EE installation:
- Log in to your EE control panel
- Go to
System Administration > Utilities > Extensions Managerand enable extensions if not enabled already - Enable DC FreeForm GeoIP extension
Currently, there are two settings for this extension:
- Automatically append IP Location Data to notyfication emails: When set to yes, the IP location data will automatically be appended to the admin notification emails. When this is set to no, you can control where in the emails the location data shoulda appear by placing
{ip_location_data}somewhere in your email template(s). - Check for updates : When set to yes, the extension will automatically check for updates. You need to have Leevi Graham's LG Addon Updater extension installed and enabled for this.
Developers
This extension provides a hook for other extensions to change the way how the location data for an IP is obtained and what is returned. The usage is very straight forward, all you need to do is implement the dc_freeform_geocode_ip hook in your extension and return whatever should either be appended to an email or replaced withing the {ip_location_data} tag in your admin email template.
We've provided a sample extension that uses this hook. Please not that if you have several extensions using the dc_freeform_geocode_ip hook, data from the last extension processed (according to the priority of the hook) will be used, but having more than one extension that delivers the location data probably does not make any sense anyway.
Download DC FreeForm GeoIP Extension Sample

Feedback
This extension has been tested to work with Expressionengine 1.6.4 and 1.6.5 and should be compatible with EE 1.4.0 or greater and most modern browsers. If you find a bug or have another feature request for this, post a comment about it here and we will be more than glad to fix or consider it.
Changelog
1.0.0
- Initial internal release
1.0.1
- Some minor bug fixes
- Rewrites of private functions
1.0.2
- Added support for LG Addon Updater
1.0.3
- Added CURL parsing of IP data from http://www.hostip.info
- First public release
Comments
Add Your Comment
Related Entries
DC Template Manager
ExpressionEngine offers the possibility to save templates from the database as files. The biggest advantage…
DC Required Category Extension
Oops we did it again! Once stared, you might think you cannot stop it—only one…
URL Field Extension for Expressionengine
Not so long after moving our old website to Expressionengine during the relaunch on May…
From Our Journal
DC Template Manager
ExpressionEngine offers the possibility to save templates from the database as files. The biggest advantage of this approach is being able to…
DC Feedback Boxes
Most website today are interactive – transfer of information is not only one-way but two-way. User are interacting with content: adding, editing…
DC FreeForm GeoIP Extension
Fresh from the coding factory comes a new, handy extension. Ever wondered where a visitor who just filled out a FreeForm on…

1 February 01, 2009 James
I noticed in requirements that there was an issue with Freeform that required you to download a special version of Freeform. Is this still the case with 2.7.1?
2 March 09, 2009 pesche
Hi James. No, the fixes needed in earlier versions are now included in the latest FreeForm release.