WordPress.org

Support

Support » Plugins and Hacks » Publish Submission As Post Type

Publish Submission As Post Type

Viewing 1 replies (of 1 total)
  • UaMV
    Participant

    @uamv

    I have made the following edits in order to allow the functionality of specifying an existing custom post type. It is working on my install. It doesn’t seem that these changes will hinder any other functionality of the plugin. If you find otherwise, let us know. I will also leave this topic unresolved, as I would like to see this implemented in future releases.

    Edits in db.php
    Add publish_post_type field to formSettingsKeys. Add following code to db.php (Line 92) in function initDefaultSettings().

    'publish_post_type' => '',

    Add publish_post_type field to fm_forms table in database. Add following code to db.php (Line 247) in function setupFormManager() in creation of forms table.

    'publish_post_type' TEXT NOT NULL,

    Edits in pages/editformadv.php
    Add publish_post_type in processing settings changes. Add following code to pages/editformadv.php (Line 32).

    $formInfo['publish_post_type'] = $_POST['publish_post_type'];

    Display option field in advanced tab. Add following code to pages/editformadv.php (Line 146).

    helper_option_field('publish_post_type', __("Publish as post type", 'wordpress-form-manager'), get_post_types( array( 'public' => true ), 'names' ), $form['publish_post_type'] );

    Edits in helpers.php
    Define post_type in arguments when publishing new post. Add following code to helpers.php (Line 447) in function fm_helper_publishPost(). Be sure to add comma to end of line 446.

    'post_type' => $formInfo['publish_post_type'] == "" ? 'post' : $formInfo['publish_post_type']

    That should do it. Enjoy!

Viewing 1 replies (of 1 total)
  • The topic ‘Publish Submission As Post Type’ is closed to new replies.