Making a Form Submission into a WP Post

November 25th, 2012 Leave a comment Go to comments

A few people have asked me if I could make the plugin make a WP Post out of a form submission. This would allow users to make a form post without logging into the WP admin area.

After some thinking, I decided it was best to provide this as a separate plugin. It is called “Form to Post”. You can install it like any other plugin. Read up on how to use it at Form to Post on WordPress.org.

  1. December 17th, 2011 at 12:46 | #1

    Will you be adding support for uploading images and other media? Even if the media is simply attached to the post (being able to attach PDFs/etc). What about uploading a featured image?

    And the big one… uploading to a Custom Post Type w/custom Taxonomies?

    Thanks for a great plugin!

    Kermit Woodall
    http://kermitwoodall.com

  2. December 17th, 2011 at 12:48 | #2

    BTW, you might want to update your wordpress.org description to put more keywords in so it’s easier to find. I never saw it there directly, I was led here by a link from another site.

    Kermit Woodall
    http://kermitwoodall.com

  3. Saira Ifzal
    March 4th, 2012 at 10:05 | #3

    hi,

    I am trying to use form-to-post plugin. I am facing slight problem. I want the form content to be posted in pages. What will be the code for it? right now I am using post_type_page but this doesn’t seem to work.

    i tested out with post_category_name and it worked fine but I want to be able to post the data/post in respective pages

    Can you help me please! I have been trying for hours now

    • Michael Simpson
      March 4th, 2012 at 10:25 | #4

      Try setting a hidden field in your form named ‘post_type’ with value = ‘page’
      See documentation on the parameters for wp_insert_post

  4. Saira Ifzal
    March 4th, 2012 at 10:05 | #5

    between thankyou for such a great plugin! it saved me a lot of time!

  5. Saira Ifzal
    March 4th, 2012 at 10:30 | #6

    @Michael Simpson

    I am not too much of an expert. If possible can you explain in more detail..I tried:

    [select* post_type=page "A" "B"] but this didn’t worked for me as well

  6. Saira Ifzal
    March 4th, 2012 at 10:33 | #7

    @Michael Simpson

    basically I have a drop down with options A, B, C ..If e.g a user selects A and submits, the post is to be posted into A. Similarly, for B and C. so right now my code goes:

    Business Name (required)
    [select* post_type_page "A" "B" "C"]

    I am not too sure how to make this work

  7. Saira Ifzal
    March 4th, 2012 at 12:22 | #8

    Michael Simpson :Try setting a hidden field in your form named ‘post_type’ with value = ‘page’See documentation on the parameters for wp_insert_post

    Okay so I am still trying for past 7 8 hours…I installed the contact form 7 modules plugin for hidden field and here is what i did.. though I am not sure if its done the right way..but still doesn’t work

    Business Name (required)
    [hidden post_type "page"]
    [select* post_type "A" "B" "C"]

    Any help please? :(

  8. Michael Simpson
    March 4th, 2012 at 14:58 | #9

    @Saira Ifzal
    I don’t think you can choose a page to post into. It will create a new page, or if you set the ID field referring to a page id number, it will probably update/overwrite the page content. If you want to append to a page you are probably better off creating a page that shows posts from a particular category, then have your form create posts in that category so that they appear on the page.

    To create a new page, you would put something like [text post_type "page"] but that would show the text field in your form. To make it a hidden field, and you are using contact-form-7-modules, then I think [hidden post_type "page"] will work but you can’t have a second “post_type” field in the form.

  9. Saira Ifzal
    March 4th, 2012 at 15:13 | #10

    @Michael Simpson

    Oops that means i a stuck..ok so if i have a page listing buisness name as categories and then do the post-
    category_name..it might work..but now i need to lookup how to show categories on a page ..hmm

  10. Saira Ifzal
    March 5th, 2012 at 01:03 | #11

    @Michael Simpson

    I think I figured out a solution..one last question. Is it possible to have the data posted as comments instead of posts??

  11. Michael Simpson
    March 5th, 2012 at 06:48 | #12
  12. Saira Ifzal
    March 6th, 2012 at 06:42 | #13

    @Michael Simpson

    okay I have got something working here..but again an issue.. I am sorry to bothering you. I want the post to show author but if I use post_author it shows up blank..any suggestion? I have tried with dynamic hidden, hidden and even with text field

    e.g [text* post_author] —-doesn’t work
    [dynamictext* post_author] —doesn’t work..similarly for dynamichidden as well and hidden field as well

  13. Michael Simpson
    March 6th, 2012 at 09:59 | #14

    @Saira Ifzal
    Looking at the documentation I see that post_author take an ID # of the author and not the name. Are you aware of that?

  14. Saira Ifzal
    March 6th, 2012 at 10:24 | #15

    @Michael Simpson

    Yes I am aware of that..It doesn’t post out the id…and there is no way a author name can be published using this plugin, that is the impression I got so far

  15. Saira Ifzal
    March 6th, 2012 at 13:26 | #16

    @Michael Simpson

    Also, neither the date and time get posted..Its like the plugin only is able to post ‘post_title’ , ‘post_content’ and ‘post_category_name’ ..the other essential things like author name/ids are not posted..which means I am stuck. Can you have a look please?

  16. Michael Simpson
    March 6th, 2012 at 21:45 | #17

    @Saira Ifzal
    I did some testing and some minor updates so I released version 0.3.
    I added “post_author_name” which you can use like:
    [hidden post_author_name "someusername"]
    Date worked for me using:
    [hidden post_date "2012-01-02 12:30:00"]
    be sure you get the date format right.
    Other misc setting seem to work for me. You can also not add custom (meta) post fields. See http://wordpress.org/extend/plugins/form-to-post/

  17. Saira Ifzal
    March 7th, 2012 at 09:07 | #18

    @Michael Simpson

    Thank you yes that seemed to work but again a slight problem..if the user is logged in, the author_post_name only works then but if a person is not logged in. the author field appears blank..I understand that the posts can be made by logged in user only in wordpress but since this is a form to post, the users are not essentially going to be logged in when accessing the contact form. the post_content and tile works whether user is logged in or not but the post_author_name doesn’t display unless user is logged in..Any suggestion or fix for that?

  18. Saira Ifzal
    March 9th, 2012 at 03:17 | #19

    @Michael Simpson

    is there a way I can put anonymous in case the user is not logged in?? ‘if’ logged in it display the username, ‘else’ display anonymous’ or the text/string entered? Is that possible? I am still stuck on this lolz

  19. Michael Simpson
    March 10th, 2012 at 13:38 | #20

    I released version 0.4 with a bug fix and a new option: post_author_default

    To make a post “anonymous” instead of having no author, I think you would need to create an “anonymous” user. Then you could set
    [hidden post_author_default "anonymous"]
    to pick up either the user’s id if logged in or set to the user “anonymous”

    Also I ran across this, you might want to check it out: http://wordpress.org/extend/plugins/indypress/

  1. No trackbacks yet.
You must be logged in to post a comment.