Ce fil est résolu. Voici une description du problème et la solution proposée.
Problem:
A Toolset Form to add a child post doesn’t save the parent post id if there is another form before it on the same page.
Solution:
This resulted from a bug which was fixed in Forms 2.1
This support ticket is created Il y a 5 années et 8 mois. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
Sorry, has taken me a little while to get back to you. Here's my update: I have gotten rid of the modals- that's not a problem. The forms now exist on the content template pages (see screenshot).
However, the post relationships still don't work properly.
Here is the problematic block of code:
add_action('cred_save_data','func_custom_post_title',15,2);
function func_custom_post_title($post_id,$form_data) {
if ($form_data['id']==243) {
toolset_connect_posts('boat-safety-check',$_POST['@boat-safety-check.parent'], $post_id);
}
if ($form_data['id']==302) {
toolset_connect_posts('safety-check-log-item',$_POST['@safety-check-log-item.parent'], $post_id);
}
}
With that code commented out: the post form submits & redirects, but the relationship isn't saved.
With that code active: the post form doesn't submit correctly, returning The parent must be a post ID or a WP_Post instance error.
I then swapped the site over to 2017 to test the form without any of my custom code: post form submits & redirects, but relationship still isn't saved.
I've then disabled all plugins apart from the toolset ones, and it still doesn't save the relationship. I'll leave it in that state so you can take a look and work out what the issue is?
I found that the problem seems to be the other CRED form you have in the same Content Template (the safety check edit form). If I remove that then the log item form works correctly.
I'm trying to see if I can reproduce on a vanilla test site, or whether it is particular to your site.
It is fixed in an update to Toolset Forms 2.1, which is currently in QA testing. That will take a few days and so barring any hiccups will be released mid next week.
Sorry for the delay, it is August when things tend to slow down a little because of holidays.