Skip Navigation

[Cerrado] Dynamically Update Content With Cred Forms on the same page.

This support ticket is created hace 6 años, 10 meses. 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.

Etiquetado: 

This topic contains 1 respuesta, has 2 mensajes.

Last updated by Beda hace 6 años, 10 meses.

Assigned support staff: Beda.

Autor
Mensajes
#315051

I have a Post Type that specific users can add/edit from the front of the site using CRED Forms. That Post Type has a parent post type (which is easily embedded into the cred form) and a many-to-many relationship with another post type using and interim post type as the child. A typical entry from this post type will have 4 of the many-many relationship post types assigned.

My current solution has the user create the post type, then click a link to a separate page where a CRED form allows them to add a single post type relationship, the CRED form is saved, then the user must return back to the main post type page and repeat this process 3 more times.

What I'd love to be able to do is to able to have the CRED form that adds the many-many post type relationship appear in a lightbox window or similar and once submitted would close the lightbox and refresh the main post type content to reflect the change.

Are you aware of any way to do this?

#315168

Thank you for contacting us here in the Support Forum and for providing the Debug Informations

It would be good that you first update your Toolset to it's latest version. Can you do this please?

❌ Be sure to backup your database first before you proceed! ❌
⌥ You can use a plugin for this if you like.
I often use the Duplicator plugin for this purpose.
See: http://wordpress.org/plugins/duplicator/

I understand you have the Post Type A with just one parent Post Type B, and the Post Type A has also a Child Post Type (MtM).

You can always edit, with CRED, in the Child Post Type the parent Post.
(as you mention, it's already embedded)

But you can't add Child Posts from the CRED form that edits (or creates) parent posts.

You need to either use a Child CRED form link, or edit/create the Child with CRED and set the parent.
https://toolset.com/documentation/user-guides/cred-forms-for-child-content/

You could use a cred_save_data hook to insert/update your Child posts with the parent Post ID once the CRED Form that edits the Parent is submitted.
https://toolset.com/documentation/user-guides/cred-api/

This requires some PHP Code approach.
It depends whether your Child Posts (MtM) already exist, or they need to create them first as well?

However, it's not a trivial approach, as you need to get the Child Posts from somewhere first, and then update the _wpcf_belongs_parent_id Custom Field, so to set the (new) parent ID for each Child.

I need further informations how exactly the process is and if the data (child Posts) are already available, otherwise, you would also need to insert those posts first (in your CRED save_data_action) with wp_insert_post.

Please could you provide me the additional Infos?

Thank you

El debate ‘[Cerrado] Dynamically Update Content With Cred Forms on the same page.’ está cerrado y no admite más respuestas.