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

Previous Post: Screenflow PC (windows) how-to   Next Post: Value of SEO Traffic vs Value of PPC Traffic

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:

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;
}

But this time, add it to the bottom of the includes/classes.php file, before the very last “?>”

Next, in the same file (includes/classes.php) search for this line:

$enctype = apply_filters( 'wpcf7_form_enctype', '' );

Directly below this line, add the following code:

$curpageurl = curpageurl();
date_default_timezone_set('GMT');
$timedate = date('l jS \of F Y h:i:s A');

Now search for this line:

. esc_attr( WPCF7_VERSION ) . '" />' . "\n";

Below which you need to add a line and insert the following code:

$form .= '<input type="hidden" name="time-date" value="' . $timedate . '" />';
$form .= '<input type="hidden" name="page-url" value="' . $curpageurl . '" />';

The next step - actually sending those values with the form, is still a mystery…

If you check the form code after making these changes you can see the source page and time/date variables being displayed… but they don’t send with the email…

If you’ve worked it out, please comment below.

Tags: , , ,

Posted in Internet Marketing and Paragliding and Travels 10 months, 2 weeks ago at 5:40 am.

4 comments

4 Replies

  1. nice tips :) was searching this thanks

  2. I never worked this out did you get to the bottom of it Vince?

  3. Anyone figured this out?

  4. Just use the tag [_url]


Leave a Reply

We may send you emails once in a while, by submitting your comment you consent to receive these emails