Skip Navigation

[Resuelto] Connect the same posts again in a Many to Many relationship

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.

Problem:
We have 2 Post Types where some of the posts might be connected more than once to each other.

As an example, letters in words, or players in soccer-teams.
A Letter can appear in many words, and a Word can hold many different letters.
A team player can be a member of a team today, and another tomorrow, and then come back to the original the day after.

All this requires to re-connect the same posts in the same relationship and that's not possible, it seems

Are there solutions?

Solution:
There are workarounds as described here and here:
https://toolset.com/forums/topic/unable-to-create-more-than-one-of-the-same-many-to-many-relationship/#post-1478079
https://toolset.com/forums/topic/unable-to-create-more-than-one-of-the-same-many-to-many-relationship/#post-1478175

It does not include Custom code, just a bit different setup than expected.

We have plans for allowing connections non-distinct relationships (multiple associations between the same two posts) as these, but no ETA

We also plan our features based on user voices, so it would be good to submit the request to allow connections non-distinct relationships (multiple associations between the same two posts), with this form:
https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/

This support ticket is created hace 4 años, 2 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.

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.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 3 respuestas, has 2 mensajes.

Last updated by Beda hace 4 años, 2 meses.

Assisted by: Beda.

Autor
Mensajes
#1478071

Please note I have submitted this as a Feature Request...

I have a situation where I have two post types: LETTER and WORD

A LETTER may occur in many WORDS and many WORDS can have the same LETTER.

However, if the same LETTER occurs more than once in a WORD, there is no way to link it more than once using a many-to-many relationship.

For example, take the WORD "pop". The LETTER "p" occurs twice. If I want to show how the WORD "pop" is spelled using LETTERS I cannot do so.

I can link the LETTER "p" once and I can link the LETTER "o" once. I am unable to link the LETTER "p" a second time.

I can display that the WORD "pop" contains the LETTER "p" and the LETTER "o"

However, what I would like to do is be able to link the LETTER "p" more than once to the WORD "pop". Then I can show all LETTERS used for the WORD "pop" and how the WORD "pop" is spelled.

I would like to be able to display that the WORD "pop" is spelled with the LETTER "p" the LETTER "o" and the LETTER "p"

I cannot see a reason why Toolset would prevent the user from doing this?

#1478079

Yes, that's right, this is not possible, and you can add your voice for this at https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/ (if not done so already)

One possible solution to your use case is to use a Custom Field in the connection to specify how many times a letter occurs.
So "P" would get value 2, "O" value 1, assume the word POP.

Another possible solution is to use a Repeatable Field Group or even a Repeating Field - where you add the letters to the Word post.

In a Repeatable Field Group, you can later threat this data the same way as Posts that are related (in Views for example, or when you display or get this data by code).
Wit a repeating field, you will have more restrictions as the field always will output all it's letters at once (in an array that you can customize depending on where you display it, but all at once).

I have already added your voice to the internal task for allowing connections non-distinct relationships (multiple associations between the same two posts)
But please, also add your voice at https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/, so it counts 🙂

Thanks!

#1478083

Thanks Beda. I have submitted the feature request. Technically, I can't see why this couldn't be implemented in a future release - but there might be reasons I'm not aware of! I can think of many examples where it would be very useful - e.g. Song Structure : Verse, Chorus, Verse, Chorus, Chorus

btw: My current workaround is to have a second, third, or fourth copy of the post but it's a bit messy.

#1478175

I didn't mean we will not implement it.
There is, as mentioned, an internal task for it.

But it's required to add voices to it, so its clear to the Produce Management that this feature is valued, or would be valued, if available in Toolset.

There is another use case:
Team players and their teams.

Imagine a soccer player from whichever team changes team, and then comes back.
Websites that show this information would profit from the same feature.

Right now they will have a 3rd Post Type in the Relationships chain.
A player, a team, and an appearance post.
The appearance post is what they create each time again when the player appears in the team.

Just, it is somewhat unexpected from the user experience side, that we cannot just use the intermediary post type as the appearance post.
That is what I'd expect, but unfortunately, this isn't possible yet.
If you try to create a new Intermediary and connect the same 2 posts again as before, you'll run in the error

Error on saving:
There already is an intermediary post for your selected combination.
Edit conflicting intermediary post.

So the only way is to create a fresh Post type and connect the related post types in a one to many relations to that "appearance" post type.
This then allows reconnecting same posts.

We will work on this in future to make it easier.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.