Skip Navigation

[Résolu] Sport Association Membership Site

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

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 2 réponses, has 2 voix.

Last updated by Beda Il y a 4 années et 10 mois.

Assisted by: Beda.

Auteur
Publications
#1274641

Hi
I read with interest the resolved ticket.
====================================================
"[Resolved] Multiple nested relationships for sports league "
and the following recommendations in that ticket.

However - here is the structure we may suggest that may help you:
You should try to create following post types:
=> League
=> Season
=> League+Season
=> League+Season+Team
=> Player
=> Team

And then try to create following relationships - this is as per what I think the best structure for you - you are free to make amendments as per your need to the following structure:

1) One to Many Where Season (parent ) and League (child)
2) One to Many Where League+Season (parent) and League (child)
3) One to Many Where League+Season (parent) and Season (child)
4) One to Many Where League+Season (parent) and Team (child)
5) Many to Many where League+Season+Team and Player
6) One to Many where League+Season+Team (parent) and League+Season (child)
7) One to Many where League+Season+Team (parent) and Team (child)

===============================================================
I am trying to understand the posts and the relation ships.
I have players who play in many teams over time and teams have many players.
Therefore my equivalent situation is to have players (members) who play in the League+Season+Team

1. Is League+Season a post-relationship and therefore we are now referring to the intermediate post table.

2. Can you expand on the 3rd level League+Season+Team
Is this a post-relationship of the intermediate post table from step 1 and Team

3. For the players are we then looking at a many to many relationships of
Is this a post-relationship of players to the post-relationship created in step 2 (League+Season+Team)

4. The next question is how to display/ edit this relationship
League
Season
Team
Player
or a better way to phrase this is for the player (member) to add themselves to the Team.

I have read the post-relationship videos but this goes 4 deep.
Thanks

#1274859

The Post Types are:
=> League
=> Season
=> League+Season
=> League+Season+Team
=> Player
=> Team

Those are all single unique post types.

Then you connect those in these relationships:
1) One to Many Where Season (parent ) and League (child)
2) One to Many Where League+Season (parent) and League (child)
3) One to Many Where League+Season (parent) and Season (child)
4) One to Many Where League+Season (parent) and Team (child)
5) Many to Many where League+Season+Team and Player
6) One to Many where League+Season+Team (parent) and League+Season (child)
7) One to Many where League+Season+Team (parent) and Team (child)

Note that parent here refers to the "One end" of the relationship, and child to the end where you can have many posts.
In case 5. where a Many to Many is created, there is no strict parent and child, as many posts can be related to many other posts.

Note, in sports websites, there is one big issue that you need to pay attention to, and I can explain it best by simplifying the quite customized example (tailored for that case) that Minesh provided.

In any structure where the same relationship can repeat (friends, school classes, players in teams, and so on), Toolset currently faces a restriction. You cannot connect the same post of one Post Type to another Post Type's post, more than once.
Even if the Many To Many Relationship actually allows to create a so-called "Intermediary Post Type", which is unique for each relationship, it will not allow you to connect the same posts more than once.

That means, with a simple Many to Many Relationship you can have many players in many teams, but you cannot have them more than once in each team. That is not how reality works. A player may go and come from teams quite often, actually.

To solve this, a logical step must be done: analyse what really happens. What really happens is that we have Players, Teams and "The time when the player is in the team". Also, we could call that an "Appearance".

So to set up successfully such relational content, you'd need to create a 3rd post type for the Appearance.
Now you can create a Connection between the Player and the Team by creating a New Appearance.
This post will be connected to one player and one team only. If the player leaves and joins again, a new Appearance is created, connected to the same player and team as before.
Hence this is a One To Many relationships between (One)Player and (Many)Appearances, and on the other site, a second relationship also One To Many where (One)Team will be connected to (Many)Appearances.

League and Teams will be the same relationship kind if it needs to be possible adding the same team many times to the same league.

I have helped build another user a website for Handball sports, also featuring teams, championships and players, medals, and more.
It took some time (around 3 months) with the help of support to achieve most of the goals with Toolset. Unfortunately, those tickets are in German, they will not help you directly here.
I can, however, be of assistance.

Note that some custom code was required to complete the project (mainly to show victories and medals etc).
I am not sure if you also will work with seasons winner data and related prices that you need to record.

I'd start with a Player and Team Post Type, together with the appearance post type and create the relationships mentioned.
Then, I can show you how you'd display those. Later, we can bring in other data such as season and others.

I'd recommend setting this up on a clean Testing site, where you later when done can grab the content you created (structures, not posts) and import them to the live site with the Module Manager for example, or even reuse it otherwise at your will.
Please let me know if you need help at any step and once you are ready with the content types, I can show how to display those.

I'll set up a private reply in case you can add login details to mentioned test site where we could work together on the task.

#1277295

1. What is the best way to work on this together, I could create a sub-site on my multisite WordPress.

Yes, that can be an idea.
Usually, you will have a staging site (single install) for development, and a production (single) site for the public face.
The Toolset can be used on MultiSites, but you cannot use it network-wide in the sense of you need to create content for each subsite, with Toolset, you cannot share that content into other subsites of the same network or grab data from other subsites.

I think a simple subsite can be a good approach to show you a few examples on which you can then build or re-use Modules of it.

I'll activate a private reply so you can submit access to such site if available

2. In WordPress, we are likely to go down the route of clubs (secretary) being users of WordPress.

Then at some point, you will need to create a Custom Post Type equivalent to those users (Clubs) because you cannot connect Post Types to users, create relationships, or filter posts by authors easily on the front end, with Toolset Views. Hence, you will want a Post Type mimicking the Club (WordPress user) so you can connect that to other post types, add Custom Fields or terms, and query the data in views.
This is explained here https://toolset.com/documentation/post-relationships/how-to-create-custom-searches-and-relationships-for-users/

3. I think then the Members of the Clubs is a post type, which will be subject to that issue I explained with the "appearances", since I assume that Person can be in many clubs and also return to clubs.
So it needs a Post Type "Appearance" that connects to Person Post (One person can have many appearances), and Appearances also should connect to Clubs, where one club can have many Appearances. Then, you can add new Appearances, and connect the right Person to the right Club.
Maybe in your case, you may call that "Appearances" post type "membership".

4. County and Province are rather simple chains, where one county can be in one Province only, but a Province can have many Counties, and Counties can have many clubs, but clubs can be just in one county. Hence this is a chain of one to many relations between the single post types.

5. Tournaments are again a different tree of relations, probably one Club can be in many tournaments, even repeatedly, so again we need an "Appearance" between Clubs and Tournaments.
Division and Team might be taxonomies added to the Tournaments.

6 However since you also want the Team to be an item in the chains, eventually only Division is a term of Tournaments, and Team would conflict with Club since that is basically the same as I understand it.
Here we would have to solve the conflict of the same purpose or misunderstanding before we can proceed on this point.

I activated a private reply in case you have access to an online testing site where I can add some examples.

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