However, I would like to allow users to create multiple posts.
currently this is possible but only the last post will be editable.
multiple editable posts
There is a built-in mechanism to do this. You need to use the cf7_2_post_id
attribute in your contact form 7 shortcode. in order to dynamicaly load a differen post, you will need to dynamically build the shortcode. This what I would do,
- List your user’s post on a page and provide a link for each which call a form page template with the post’s id as a url attribute
- in your form page template will seek the url attribute post id to load in the cf7 form, (
$post_id=$_GET['post']
) and if one is found, include it your dynamic form shortcode,
do_shortcode('[cf7-form cf7key="your-form-key" cf7_2_post_id="'.$post_id.'"]');
An alternative approach if you do not have too many posts for each user, is to build all your forms and hide them in an accordeon display. The plugin allows you to work with multiple forms per page.
NOTE: it is important that when you dynamically load a saved post for editing for a given user using a url attribute, to actually check that the current logged-in user is the author of this saved post (which when initially submitted and saved by the plugin is the default behaviour to assign the post to the user that submitted the form), this will ensure that no user can trick the system and load another user’s data.
Thread Starter
tsvn
(@tsvn)
Thank you so much, just what I needed.