event start & end date not updated
-
i am create a form for frontend user that submited our event from frontend. event name or discription updated only issue with date so plz help.
code bellow–
<?php if( ‘POST’ == $_SERVER[‘REQUEST_METHOD’] && !empty( $_POST[‘action’] ) && $_POST[‘action’] == “new_post”) {
if (isset ($_POST[‘title’])) {
$title = $_POST[‘title’];} else {
echo ‘Please enter the event name’;
}
if (isset ($_POST[‘description’])) {
$description = $_POST[‘description’];
} else {
echo ‘Please enter some notes’;
}$startdate = $_POST[‘startdate’];
$enddate = $_POST[‘enddate’];$new_post = array(
‘post_title’ => $title,
‘post_content’ => $description,
‘post_status’ => ‘publish’, // Choose: publish, preview, future, draft, etc.
‘post_type’ => ‘ai1ec_event’ , //’post’,page’ or use a custom post type if you want to‘startdate’ => $startdate,
‘enddate’ => $enddate,
);
$pid = wp_insert_post($new_post);
update_post_meta($pid, ‘ai1ec_start-date-input’, $startdate, true);
update_post_meta($pid, ‘ai1ec_end-time-input’, $enddate, true);
do_action(‘wp_insert_post’, ‘wp_insert_post’);
wp_redirect( home_url() . ‘/add-event/’);
}
?><p>
<label>Start Date:</label>
<input type=”text” name=”startdate” id=”startdate” class=”input-xlarge” value=”<?php the_author_meta( ‘startdate’, $current_user->ID ); ?>” />
</p>
<p>
<label> End Date:</label>
<input type=”text” name=”enddate” id=”enddate” class=”input-xlarge” value=”<?php the_author_meta( ‘enddate’, $current_user->ID ); ?>” />
</p><p>
<input name=”updateuser” type=”submit” id=”updateuser” class=”submit button btn btn-primary” value=”<?php _e(‘Submit’, ‘Post event’); ?>” />
<input type=”hidden” name=”action” value=”new_post” />
<?php wp_nonce_field( ‘new-post’ ); ?>
<!– <button type=”submit” class=”btn btn-primary”>Update Profile</button> Deactivate your account–>
</p></form>
please help .
- The topic ‘event start & end date not updated’ is closed to new replies.