So i've just found this:
https://toolset.com/forums/topic/child-cred-form-on-parent-post/
Which sounds to me like it should do what I want. I've added that code, and the parent is correctly set in the CRED form, but when I submit the fom, there is no relationship saved?!?
Minesh
Supporter
Idiomas:
Inglés (English )
Zona horaria:
Asia/Kolkata (GMT+05:30)
Well - Thanks for your confirmation.
I used following code to set your current post ID value for parent select dropdown:
[cred_field field='@boat-safety-check.parent' select_text='--- not set ---' value="[wpv-post-id]" use_select2="never" class='form-control' output='bootstrap']
Could you please confirm it works for you.
Hmm, still doesnt work. Field is auto-populated correctly, but it doesn't save the association......
Minesh
Supporter
Idiomas:
Inglés (English )
Zona horaria:
Asia/Kolkata (GMT+05:30)
Well - I would like to know here - have you migrated from the legacy post relationship with new many to many post relationship OR you just build everything with Toolset Beta plugins?
Fairly sure it's all built from scratch- that's what was suggested to me by support in the first place.
Minesh
Supporter
Idiomas:
Inglés (English )
Zona horaria:
Asia/Kolkata (GMT+05:30)
Ok - the thing was that the API support for new relationship was not released yet but as it was a simple change, only 2 files needed to make this work. I've updated those required files to your types and CRED plugins.
However - we are going to release new version for all Toolset plugins by next week, its currently undergoing QA.
I've added following code to your current theme's functions.php file:
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);
}
}
Now, I can see that once you add the new record - in backend its displayed as connected to selected boat. Could you please confirm.
OK, great! thanks heaps- appears to be working! OK, so do I need to remove that code once it's updated I assume? Will I get notified of the update in the WP dashboard or do I need to come back here to get the latest versions?
Minesh
Supporter
Idiomas:
Inglés (English )
Zona horaria:
Asia/Kolkata (GMT+05:30)
Glad to know that its working fine now for you as well.
do I need to remove that code once it's updated I assume?
==> No - you need to keep the code I've added in your functions.php file.
Will I get notified of the update in the WP dashboard or do I need to come back here to get the latest versions?
==> Yes - once we release new version - you will see the notice on your plugins page to update plugins to latest version. However - please keep eye on our blog to have latest updates.
=> https://toolset.com/blog/
OK, so if I add another child post type i'm gonna have to add more if statements? That seems problematic- this all seems like a pretty basic function that should just work from the start?
Minesh
Supporter
Idiomas:
Inglés (English )
Zona horaria:
Asia/Kolkata (GMT+05:30)
Yes - as you need to state to which post relationship you need to connect the post to - its obvious thing.
However - what you are saying, we are already on it and we have introduced post relationship forms - please check it out and try to play with it:
=> https://toolset.com/documentation/post-relationships/how-to-build-front-end-forms-for-connecting-posts/
We are about to release the new version and your comments are valuable for us. As your original issue is resolved, May I kindly ask you to open a new ticket with your each new question. This will help other users searching on the forum and help us to write correct resolve ticket summery.
Thank you for understanding. Glad to help. Have a nice day!
Minesh
Supporter
Idiomas:
Inglés (English )
Zona horaria:
Asia/Kolkata (GMT+05:30)
Could you please kindly close this ticket.