Skip Navigation

[Résolu] How to connect post in one-to-many post relationship using post relationship form and delete relationship or disconnect posts.

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:
How to connect post in one-to-many post relationship using post relationship form and delete relationship or disconnect posts.
Solution:
To connect post in one-to-many post relationship you will have to use the post relationship form and to delete the relationship you can use the shortcode [cred-delete-relationship].

You can find the proposed solution in this case with the following reply:
- https://toolset.com/forums/topic/need-to-have-an-front-end-edit-one-to-many-relationship-form/#post-2365793

Relevant Documentation:
- https://toolset.com/documentation/programmer-reference/forms/cred-shortcodes/#cred-delete-relationship
- https://toolset.com/course-lesson/front-end-relationship-forms-for-connecting-posts/

100% of people find this useful.

This support ticket is created Il y a 2 années et 5 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Ce sujet contient 7 réponses, a 2 voix.

Dernière mise à jour par Jaime Il y a 2 années et 5 mois.

Assisté par: Minesh.

Auteur
Publications
#2365709

Tell us what you are trying to do?
I think my issue is not rocket science, but since I'm working with Elementor Pro Templates, sometimes it's difficult to reach some basic stuff.

I need to have a one-to-many relationship form on frontend to edit those relationships (Films -> Awards, in my case)
I red some tickets but I couldn't found any really helpful.
I'm aware I need to create a Content Template in order to display the Edit Form, but I'm using Elementor Templates to display my Films, so, I'm not sure but I think I'm having some problems for that.

I had the same issue with Post Types Editing Forms, and we can solve it,
https://toolset.com/forums/topic/edit-form-with-elementor/
but i'm trying to reproduce the problem and I can't do it.

Is there any documentation that you are following?

Is there a similar example that we can see?

What is the link to your site?

#2365729

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Can you please share bit more details where on what page/post you want to display the edit post relationship form as well as on what elementor template you want to display it?

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2365761

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Can you please share sample post link where I can see the Edit link you added?

#2365789

I have a page
lien caché
containing this relationship form
[cred-relationship-form form='editar-relationship-festival-pelicula']

I also have a Page
lien caché
containing the View
'Relationship Post Editar'

where i inserted several links just trying to make it works

[cred-relationship-form-link form='editar-relationship-festival-pelicula' child_item='$current' content_template_slug='borrador-automatico']Conectar otro/a Pelicula[/cred-relationship-form-link]

[cred-relationship-form-link form='editar-relationship-festival-pelicula' parent_item='$current' content_template_slug='borrador-automatico']Conectar otro/a Festival[/cred-relationship-form-link]

lien caché;" class="btn jf-button-editar">Editar Pelicula

But none of them works...
As you can see i'm getting lost
🙁

Thanks Minesh

#2365793

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

For the page where you added the view: lien caché

When we click on any item, it adds the "postid" as URL param that holds the ID of the parent post:
- lien caché

The page where you added the post-relationship form, I've changed the shortcode as given under:
- lien caché

[cred-relationship-form form='editar-relationship-festival-pelicula' parent_item="[wpv-search-term param='postid']"]

I can see now when you click on any "Editar Pelicula" link, it does automatically select the parent item in the select2 dropdown box, for example check this post:
=> lien caché

#2365845

Sorry Minesh for my delay on answering you.
Thanks for your correction. Now, I can see what you say and it works properly.

But as far as I can see I can only use this Edit Relationship form to add a new "Festival" to a given "Pelicula"
Let be be more clear here:

This Edit Form gives me the ability to relate a "Festival" without any "Pelicula" related. But I can't change a previous relation right?
I mean, if I have for example "Pelicula A" related with "Festival A" I can't change it to "Pelicula B" related to "Festival A"
Is this possible to do?

(Sorry I'm not sure I'm being clear enough)
Thanks Minesh again!

#2365883

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

To delete the relationship, you can use the following shortcode within your view's loop:

[cred-delete-relationship role_items='$fromViews' relationship='pelicula-festival']Eliminar esta relación[/cred-delete-relationship]

More info:
=> https://toolset.com/documentation/programmer-reference/forms/cred-shortcodes/#cred-delete-relationship

So, what you will need is a connect form to connect the posts for your relationship, the delete post link will be displayed with your view with every loop item using the above shortcode.

#2366683

My issue is resolved now. Thank you!