Vince Samios - Internet Entrepreneur

Internet Marketing and Search Engine Optimization Consultant - From the Sky to the Earth and the Ether of the Web
New: Contact Form

Contact Form 7 IP Address, Date/Time and Page URL

Make sure to get FREE DIY SEO link packages Vince's Links

In a previous post I wrote about adding an IP address field into Contact Form 7 1.9.3

Since then there have been major updates to Contact Form 7, which renders the initial how-to inaccurate.

Luckily - in recent updates Contact Form 7 has added a new tag [wpcf7.remote_ip] which replaces the Adding IP part of my tutorial.

Two functions which haven’t been added and which now no-longer work with my old how-to are adding date and time to Contact Form 7, and adding the Source Page into Contact Form 7.

The function for adding the source page is still the same: Continue Reading…

Tags: , , ,

Posted 4 months, 3 weeks ago at 5:40 am.

1 comment

Adding Visitor IP and Current Page to “Contact Form 7″ Wordpress Plugin

I’ve loved using the Contact Form 7 Wordpress Plugin so far, but it was missing two VITAL features:

I was unable to send the visitors IP address with the form submission, and I was unable to tell which exact page the form submission came from if I was using the form on more than one page.

Here is a fix for both of those little short falls:

Edit the plugin - You can do this through the wordpress plugin editor http://YOUR-DOMAIN-NAME/wp-admin/plugin-editor.php

Paste the following code just above the last line of code - The last line of code is simply “?>”

function curPageURL() {
$pageURL = ‘http’;
if ($_SERVER["HTTPS"] == “on”) {$pageURL .= “s”;}
$pageURL .= “://”;
if ($_SERVER["SERVER_PORT"] != “80″) {
$pageURL .= $_SERVER["SERVER_NAME"].”:”.$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}

Next search for this line of code which should appear directly in the middle of the plugin:

$form .= ‘<div style=”display: none;”>’;

Below this line, paste the following code.

// Addition By: Vince Samios, http://vincesamios.com
$curpageurl = curpageurl();
$visip=$_SERVER['REMOTE_ADDR'];
$form .= ‘<input type=”hidden” name=”page-url” value=”‘ . $curpageurl . ‘” />’;
$form .= ‘<input type=”hidden” name=”visitor-ip” value=”‘ . $visip . ‘” />’;

Now you can reference these values in the email like you would any other form field. Example below

Page: [page-url]
IP: [visitor-ip]

Another useful piece of code by “Travis” is for adding the contact form in PHP - this is useful if you would like to include it in the theme.

echo apply_filters(’the_content’,’

Article Writing

Here is a list of services Niki offers out of the box - you can also ask for something specific in the form below.

Select from the following:

Web Copy - Quality writing for websites

- Quantity


Content rewriting - £3 per 100 words



E-Book Writing - Formatter and PDF'ed



Regular Blog Writing and Posting - 350 Words - One link



Your details:


Name*
Email*
Primary Keywords
Notes:
In order to verify that you are human, you will need to enter
the captcha code below into the corresponding box.
Are you human? captcha

‘);

Update:
Added time and date of submission - Add this in the same place as the Visitor IP and Current Page additions.

date_default_timezone_set(’GMT’);
$timedate = date(’l jS \of F Y h:i:s A’);
$form .= ‘<input type=”hidden” name=”time-date” value=”‘ . $timedate . ‘” />’;

You can reference the time and date in the contact enquiry email by using:

[time-date]

Tags: , , , ,

Posted 12 months ago at 3:30 pm.

7 comments