PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Overwrite Custom Post type using Form?

  1. graphical_force

    Hi, I have a form that users can use to become a Vendor. Submission of the form creates a custom post type and stores other fields of the form in custom fields. The issue I am having is that the user cannot edit their Vendor Custom Post Type. What I was wanting to know if it is possible for them to overwrite the custom post type if they submit a new form? Right now, it will just show two custom post types.

    Anyone have any suggestions?


    Posted 11 years ago on Wednesday January 23, 2013 | Permalink
  2. How about this 3rd party plugin:

    Editing an existing entry or post created by a form is not a feature of Gravity Forms.

    The Directory and Add-ons add-on might also help, although it would change the way your directory is displayed:

    Finally, there is probably a way to load the existing post into a form and allowing the user to change the values and submit again. It would create a new entry, but you could update the existing post rather than create a new post.

    Posted 11 years ago on Wednesday January 23, 2013 | Permalink
  3. graphical_force

    Thanks for the reply. How might I go about loading a post into a form?


    Posted 11 years ago on Wednesday January 23, 2013 | Permalink
  4. Well, it's slightly complicated and I don't know of anyone who has posted a complete solution. In theory though, it would work like this:

    Create a form with all the fields of the post you want people to be able to update. This could be similar to the form you currently use to create the post. I would not use post fields since that will create a new post. I would use regular form fields of the relevant type (file upload for a post image, single line text for the post title, paragraph for the post body, etc.)

    Then, on the advanced tab of each field you want them to be able to edit, check the "Allow field to be populated dynamically" and give the field a unique parameter name.

    Then, you would need to write a function that uses the gform_pre_render filter to pull information from the custom post to populate those fields.

    In the function, you would retrieve the information from the post you want to update, ( ) then populate the fields with that information. When the form is displayed, that information will be visible in the form, ready to be edited.

    On submission, you would have to use the gform_after_submission hook to update the existing post ( ). You would take all the information that was submitted and rewrite (update) the existing post.

    It's possible to do. You'd have to consider how to allow only certain users to update certain posts, and how to display the list of posts they can edit.

    Another way around it would be to allow the logged in user to just edit the post on the front end. This would just be a WordPress plugin function. Something like this

    Good luck

    Posted 11 years ago on Thursday January 24, 2013 | Permalink