Home › Forums › Quform WordPress › How to autofill the Advanced Custom Fields with the form's data?
- This topic has 3 replies, 2 voices, and was last updated 11 years, 7 months ago by Ally.
- AuthorPosts
- April 30, 2013 at 11:24 pm #4185haritosParticipant
Hello!
I want to autofill the Advanced Custom Fields , that i use in my posts, with the form’s data as i do in the functions.php with the autopost creation.
Is this possible to do it?
e.x. Let’s say i have two custom fields, made by “Advanced Custom Fields”, the “First Name” and the “Last Name”. And i have a form with two fields the “First Name” and the “Last Name”. I want to autofill the custom fields after the submission of the form and make the post in draft status.
May 2, 2013 at 8:20 am #4221AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
May 2, 2013 at 8:29 am #4222haritosParticipantHello Ally,
I’ve added the code below and works fine:
add_post_meta($post_id, 'link_diagwnismou', $form->getValue('iphorm_1_11'));
Thank you for all!
By the way, use gave me a code to insert the submitted image into the post but by inserting the code in the functions.php an error occurs. This is the code you gave me:
// Insert the post
$post_id = wp_insert_post($post);// Add attachments
$file = $form->getValue('iphorm_2_4');if (isset($file[0])) {
$file = $file[0];
$filename = $file['text'];
$path = $file['fullPath'];$wp_filetype = wp_check_filetype($filename, null);
$attachment = array(
'post_mime_type' => $wp_filetype['type'],
'post_title' => sanitize_file_name($filename),
'post_content' => '',
'post_status' => 'inherit'
);$attach_id = wp_insert_attachment($attachment, $path, $post_id);
require_once(ABSPATH . 'wp-admin/includes/image.php');
$attach_data = wp_generate_attachment_metadata( $attach_id, $path );
wp_update_attachment_metadata( $attach_id, $attach_data );set_post_thumbnail( $post_id, $attach_id );
And you also told me to make a change in this:
$value = array(
'url' => iphorm_get_wp_uploads_url() . '/' . $result['path'] . $filename,
'text' => $filename
);To this:
$value = array(
'url' => iphorm_get_wp_uploads_url() . '/' . $result['path'] . $filename,
'text' => $filename,
'fullPath' => $fullPath
);Please can you tell me what might be the problem?
May 2, 2013 at 11:52 am #4234AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- AuthorPosts
- You must be logged in to reply to this topic.