I'm getting most of what's going on in the following code, with some help from http://www.php.net and http://codex.wordpress.org/Function_Reference/.
In its current situation, only one page on the site triggers the popup form if no cookie is set. Is that functionality specified within this code?
Here's the functions:
if (isset($_POST['confirm']) && isset($_POST['location'])) {
setcookie("Location", $_POST['location'], time()+3600);
}
elseif (!isset($_COOKIE["Location"])) {
setcookie("Location", "", 1);
}
elseif (isset($_POST['deny'])) {
setcookie("Location", "", 1);
}
// Popup confirmation
function show_popup($content) {
global $post;
$location = get_post_meta($post->ID, 'location', TRUE);
if (strtolower($l) == strtolower($location) || strlen($location) == 0
|| (isset($_COOKIE["Location"]) && strtolower($_COOKIE["Location"])
== strtolower($location))) {
return $content;
} else {
?>
<div id="popup">
<p>Foo.</p>
<p>Yes/No?</p>
<form action="<?php echo $PHP_SELF ?>" method="post">
<input type="hidden" name="location" value="<?php echo $location; ?>" />
<input type="submit" name="confirm" value="Yes" />
<input type="submit" name="deny" value="No" />
</form>
</div>
<?php
}
}
add_filter('the_content', 'show_popup');
// Adds content to the <head> tag
function add_meta_content() {
if(isset($_POST['deny'])) {
?>
<meta http-equiv="refresh" content="0;url=<?php bloginfo ('wpurl') ?>">
<?php
}
if(isset($_POST['confirm'])) {
?>
<meta http-equiv="refresh" content="0;url=<?php echo $PHP_SELF; ?>">
<?php
}
}
add_action('wp_head', 'add_meta_content');
$PHP_SELF
, in the above code you will get the same effect by not specifying an action at all, or by specifying an empty acction on your form element