Thanks for your quick reply. I do suspect that the fields are empty because the post has not been submitted yet, which leaves me to the alternative of populating the map variable field on the other side, where I am sure that there is content because errors are properly returned when I specifically leave those fields empty on the form.
After submitting this inquiry to the forum, I went back to the submit form and added $_POST['_field1'] . $_POST['field2'] and that didn't retrieve the data from the previously entered fields either.
Since this is wordpress, I am constructing an array of essential data after the error checking is done. Custom fields are part of post_content so my options for gathering up the separate fields there are a little mind boggling, expecially at this point after hours of head-banging.
Rather than trying to isolate the pieces of code from the post submission script, I am including it in its entirety:
Code: Select all
<?php
require_once(ABSPATH . "wp-content" . '/recaptcha-php-1.11/recaptchalib.php');
set_time_limit(0);
if (isset($_POST['action']) && $_POST['action'] == 'post' && wp_verify_nonce($_POST['_wpnonce'],'new_post')) {
$cat = array('14'); // assign post to Outrage Events category
$err = "";
$successurl = home_url('/thank-you/');
$current_user = wp_set_current_user( '3', 'Guest' );
$post_title = $_POST['post_title'];
$post_content = $_POST['post_content'];
$post_tags = $_POST['post_tags'];
$eventDate = $_POST['_ct_text_4e3318cbab83d'];
$eventTime = $_POST['_ct_text_4e3318eb1dcfb'];
$venueName = $_POST['_ct_text_4e33193f0534b'];
$venueAddress = $_POST['_ct_text_4e3319808b191'];
$venueCity = $_POST['_ct_text_4e3319a842272'];
$venueState = $_POST['_ct_selectbox_4e33203191562'];
$venueZip = $_POST['_ct_text_4e33216358869'];
$eventCost = $_POST['_ct_text_4e3321dad4b02'];
$eventPic1 = $_FILES['image001'];
$RealLifeName = $_POST['_ct_text_4e332285061bb'];
$EventRole = $_POST['_ct_text_4e3322b1ab13d'];
$SubmitEmail = $_POST['_ct_text_4e3322dc62a6e'];
/*$_ct_text_4e40d58483b14 = $_POST['_ct_text_4e40d58483b14'];*/
if ($err == "") {
$privatekey = "6LfNTsYSAAAAAGYtbj60FlpYSYBJggLNTHrJHXSz";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
die ("The reCAPTCHA wasn't entered correctly.
Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
}
else {
if ($post_title == "") {
$err .= __('Oops! We need an Event Name!') . "<br />";
}
if ($post_content == "") {
$err .= __('Please complete Event Details') . "<br />";
}
if ($eventDate == "") {
$err .= __('Oops! What is the date of your event?') . "<br />";
}
if ($eventTime == "") {
$err .= __('Oops! What time does the event start?') . "<br />";
}
if ($venueName == "") {
$err .= __('We can\'t get there without a Venue name!') . "<br />";
}
if ($venueAddress == "") {
$err .= __('We can\'t get there if we don\'t know the address!') . "<br />";
}
if ($venueCity == "") {
$err .= __('Oops! What city is the event in?') . "<br />";
}
if ($venueState == "") {
$err .= __('Well ... knowing the state would help too.') . "<br />";
}
if ($venueZip == "") {
$err .= __('Oops! You forgot to enter the zip code.') . "<br />";
}
if ($eventCost == "") {
$err .= __('Oops! We need to know how much the event costs.') . "<br />";
}
if ($eventPic1 == "") {
$err .= __('Oops! At least one picture, please.') . "<br />";
}
if ($RealLifeName == "My real life name is...") {
$err .= __('Oops! We can\'t publish your event without knowing your name.') . "<br />";
}
if ($EventRole == "And I am...") {
$err .= __('Oops! We need to know your role.') . "<br />";
}
if ($SubmitEmail == "My email") {
$err .= __('Oops! We need to know your email address.') . "<br />";
}
if ( $err == "" ) {
/*$_ct_text_4e40d58483b14 = array ($venueAddress+$venueZip);*/
/*$_ct_text_4e40d58483b14 = '$venueAddress' . '$venueZip';*/
/*$ct_text_4e40d58483b14 = $_POST ['_ct_text_4e3319808b191'.'_ct_text_4e33216358869'];*/
/*$combined = $_POST['textfield_1'] . $_POST['textfield_2'] . $_POST['radio_button']; example code */
/*$ct_text_4e40d58483b14 = $_POST['_ct_text_4e3319808b191'] . $_POST['_ct_text_4e33216358869'];*/
/*$_ct_text_4e40d58483b14 = ($venueAddress . $venueZip);*/
$new_post = array(
'post_author' => $user_id,
'post_title' => $post_title,
'post_content' => $post_content,
'post_category' => $cat,
'post_status' => 'draft',
'tags_input' => $post_tags,
);
// save the post
$post_id = wp_insert_post( $new_post);
if ($_FILES) {
foreach ($_FILES as $file => $array) {
$newupload = insert_attachment($file,$post_id);
// $newupload returns the attachment id of the file that
// was just uploaded. Do whatever you want with that now.
}
}
wp_redirect( $successurl );
exit;
}
}}}
I prettied up the custom field names for my previous post but you will see some rather convoluted variable names here that begin with _ct. I've also left in "remarked out" failed attempts.
As for your question about the plugin, it was the only Google Maps plugin that I found which worked with Custom Fields. If you are asking whether I can populate the data with text in quotes, I cannot. The user MUST fill in the address fields as the site requisitioner did not supply a list of venues.
I am still desperate. Anything that you have to offer that would make this work would be most appreciated.
I'm even willing to discuss compensation for your time AFTER I am paid on delivery for this effort. I'm available on Skype and willing to stay up late if you want to contact me there. My handle is marj (dot) wyatt.