Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • in reply to: Create post from form data and redirect #26800
    maxim
    Participant

    Hello and thank you for your time. I’m aware that this is custom work that is not included the support and i appreciate it very much. This works excellent.
    I will give a 5 star rating on codecanyon.
    Thanks again and i hope that i was not too much of a hustle.

    in reply to: Create post from form data and redirect #26746
    maxim
    Participant

    Hello,
    That works but i need something more.
    I want to use a form-post.php file to edit the layout of the final post.
    Also i have to types of image uploads. One goes to the featured image (that works) and the other i want to make it a gallery (now it only takes the first image and it’s loaded only as single image).

    in reply to: Create post from form data and redirect #26671
    maxim
    Participant

    hello, sorry for the late reply.
    I want to redirect to a post generated by the form they just completed.
    The post is generated but the redirect is going to the homepage and not the generated page.

    This is the code i have in the custom plugin php:
    <?php

    /*
    * Plugin Name: Quform Custom Code
    * Description: Custom code for Quform.
    * Version: 1.0
    */

    // Paste in your custom code below
    add_filter(‘quform_confirmation_redirect_url_1_1’, function ($url, Quform_Confirmation $confirmation, Quform_Form $form) {
    $url = ‘http://dautor.noocstudio.com/test&#8217;;
    $title = $form->getValue(‘quform_1_9’);
    $content = $form->getValue(‘quform_1_3’);

    $files = $form->getValue(‘quform_1_14’);

    if (isset($files[0][‘url’])) {
    echo ‘‘;
    }

    $post = array(
    ‘post_title’ => $title,
    ‘post_content’ => $content,
    ‘post_type’ => ‘post’,
    ‘post_status’ => ‘publish’
    );

    $postId = wp_insert_post($post);
    wp_set_object_terms($postId, ‘Participant-2018’, ‘category’);

    // Add attachment
    $file = $form->getValue(‘quform_1_10’);

    if (isset($file[0])) {
    $file = $file[0];
    $filename = $file[‘name’];
    $path = $file[‘path’];

    $wpFiletype = wp_check_filetype($filename);

    $attachment = array(
    ‘guid’ => $file[‘url’],
    ‘post_mime_type’ => $wpFiletype[‘type’],
    ‘post_title’ => preg_replace(‘/\.[^.]+$/’, ”, $filename),
    ‘post_content’ => ”,
    ‘post_status’ => ‘inherit’
    );

    $attachId = wp_insert_attachment($attachment, $path, $postId);

    require_once ABSPATH . ‘wp-admin/includes/image.php’;
    $attachData = wp_generate_attachment_metadata($attachId, $path);
    wp_update_attachment_metadata($attachId, $attachData);

    set_post_thumbnail($postId, $attachId);
    }

    return $url;
    }, 10, 3);

Viewing 3 posts - 1 through 3 (of 3 total)
Be inspired. © 2025 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy