Creating Posts from Forms

Home Forums Quform WordPress Creating Posts from Forms

This topic is: not resolved

This topic contains 6 replies, has 2 voices, and was last updated by  therondp 2 days, 12 hours ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #29407

    therondp
    Participant

    Hi there can QuForm create posts from the data submitted in the form like Gravity Forms does?

    #29433

    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #29442

    therondp
    Participant

    Thanks for sharing I followed the guide step by step and got a failed plugin upload message – This code (below message) I used in a folder called quform-custom-code which I zipped and then uploaded to my WordPress plugin upload. The post type coupons I entered in the code is one of my custom post types.

    I am wondering if one of your developers could whip up the basic plugin for this with the option to add Post Title, Post Content, Featured Image, categories and custom fields? That would really help me and I’m sure it’s second nature to your developers to do quickly.

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

    // Paste in your custom code below

    add_filter(‘quform_post_process_7’, function (array $result, Quform_Form $form) {
    $title = $form->getValue(‘quform_7_1’);
    $content = $form->getValue(‘quform_7_15’);

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

    wp_insert_post($post);

    return $result;
    }, 10, 2);

    #29454

    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #29460

    therondp
    Participant

    Thanks for that here is the page the form is on https://imdiscountcodes.com/test-page/

    And here are the fields needed for posting to the custom post called Coupons

    The first two fields of name and email address are not needed for posting and also no categories are needed.

    Field 1: Name of app on promotion = title of post
    Field 2: Website (custom field) = wp_coupons_discount_url
    Field 3: Coupon code (custom field) = wp_coupons_discount_code
    Field 4: Discount amount (custom field) = wp_coupons_discount_percent
    Field 5: Company logo = featured image of post
    Field 6: Promotion Expiry Date (custom field) = wp_coupons_expiration
    Field 7: Describe the promotion = standard post content area

    I hope that all makes sense and I really appreciate your support on this!

    Best wishes
    Paul

    #29470

    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    Attachments:
    You must be logged in to view attached files.
    #29480

    therondp
    Participant

    That’s great thanks so much it worked perfectly!

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

Be inspired. © 2019 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy