Skip Navigation

[Resolved] Can TOOLSET accomplish mulit-level Custom Post relationships

This support ticket is created 7 years, 2 months ago. 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.

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)

Author
Posts
#572656

I have been using TOOLSET for over 3 years and it is incredible. I have developed very many complex sites and it has been an indispensable tool for me.

However, now I think I am going to put it to the ultimate test. And before I begin, I would like to know you opinion of whether it can handle my requirements.

I am building a sports league website. There is already an existing custom built site that I previously developed 12 years agao and I will be trying to "clone" it as best I can using TOOLSET.

Please tell me if you think TOOLSET can handle the following.

I will have several CPTs. Here they are, and here is their relationships.

1) SPORTS - I will have many SPORTS (basketball, football, etc..)
2) LEAGUES - I will have many LEAGUES. Each LEAGUE will belong to a SPORT
3) TEAMS - I will have many TEAMS. Each TEAM will belong to a specific LEAGUE
4) PLAYERS - I will have many PLAYERS. Each PLAYER will belong to a TEAM or several TEAMS

So it seems like I will be having some deeply nested relationships. Do you feel that there is any issue here? BTW: I am waiting for your new version of TOOLSET to be released at the end of September to do this. it seems like it has a better GUI for this type of stuff.

Lastly, how would you recommend handing the PLAYERS? I want PLAYERS to be able to login (using CRED) and see information regarding their account, the TEAMS they belong to, etc.... This sounds like something that is more applicable to USERS (like in Woocommerce).... however TOOLSET isn't really hooked into USERS so I cannot create custom USER fields and extract the WP-Types Shortcodes from those USER'S fields (or am I wrong about this?) ... so I don't understand how I will be able to do this.

Any recommendations or sample sites would be appreciated.

#572813

Well, what you describe should be relatively easy with Toolset, even without the new release of the Many To Many features in Types.
This coming release will make one thing in your above project easier:
The handling of many-to-many relations, as your Players have in Teams.

Right now, for this, you need to create an intermediate Post Type so to connect each player and team multiple times.

In the future, this will not be required anymore, and you can just connect many players to many teams with one workflow.

The other relations, as you describe them, are just a parent/child chain, which is doable with Types / Toolset.

I would even suggest thinking about Taxonomies or Fields, instead of Post Types, especially for your Sports.
It seems redundant to me, using Post Types for this.

The rule of thumb I follow when building such complex structures is to classify the data as follows, on top the one to use the less, bottom the one to use the most:
- post types
- taxonomies
- fields

This means I always try to have as fewer post types as possible, and enrich them with Fields and taxonomies, instead of building complex relationships and query them, I can just run one query and filter posts by directly associated meta-data or taxonomy terms.

Anyway, with the current Types, your goal is achievable, and it will be easier with the new Types release.

Toolset can also create, edit, login/logout users.
It can also add User Fields, which act more or less the same as Post Fields.

We provide ShortCodes for Custom Log In, Log Out, forgot password and more forms.

With some custom code, you can even let the User Data "talk" to the post Data on particular CRED form Submits.

Please open a new ticket for this topic if you require more help on it, as it is another part of Toolset, not related to the Post Types creation.

Please let me know if I can help you further!

#573327

Hi Beda,

Thank you for your reply. Yes, I figured that it would be doable with TOOLSET... but I'm still unsure about a few things. I understand your recommendations regarding SPORTS and making them a taxonomy. That makes sense and I will take a hard look at that.
I am still unsure about the PLAYERS (aka USERS). I understand that I can create custom fields for USERS just like I do for CPTs.... but how do I make USERS be a child of another CPT? For example, if a USER signs up for multiple TEAMS, they that USER should be a child of each of those TEAMS. And each of those TEAMS will a child of their own respective LEAGUES.... so naturally the USER would be a grandchild of those LEAGUES. And so on...

This is doable in TOOLSET with the applicable shortcodes?

#573623

In future, the many to many (PLAYERS belong to many TEAMS) will be easily set up in one workflow.

Right now, you need to do an extra step:
- create an intermediate Post Type
- This Post type is child to both TEAMS and PLAYERS
- Each new connection betwenn a PLAYERS and a TEAMS needs a new intermediate Post.
Each of those will be one possible connection.

As for simple relationships, where one post can belong to one parent of a certain type only, Toolset can handle infinite Chains of Parent/Child, the only limit is the performance (if you would nest tens of post types as example).

It is possible now, and easier in future.

Please let me know if you need specific help or instructions on the subject.

#574539

I am still confused....

PLAYERS are actually WordPress USERS.

So I really don't need to create a Custom Post Type for PLAYERS.... I will just use the existing WordPress USERS.

But if I do that, how do I create a Many-to-Many relationship between USERS and TEAMS?

#574543

Another issue that I am facing is that my PLAYERS/USERS will have many roles administratively.

For example, I will have roles for....

PRESIDENT - The President can edit the information for a LEAGUE that he is assigned to or any TEAM or PLAYER within that LEAGUE.
CAPTAINS - Captains are merely PLAYERS/USERS with elevated privileges so that they can edit the TEAM(s) that they belong to.
MEMBERS - Members are simply PLAYERS/USERS that can edit their own Profile and see what TEAMS and LEAGUES they belong to.

In some cases a PLAYER/USER might be a Captain of one Team (Team 1)... but only a Member of a different team (Team 2). In this case, they would be able to edit information about Team 1 (because they are a Captain of that team)... but they would not be able to edit information about Team 2 (because they are simply a Member).

Likewise any person could be a
PRESIDENT of one (or more) LEAGUES
a CAPTAIN of one (or more) TEAMS
and a
MEMBER of one (or more) TEAMS

#574808

I understand.

Users cannot be connected to Post Types in WordPress, unless trhu the authorship.
Each user can, therefore, be connected to many posts, but each post only to one user.

A solution to this limitation of WordPress is to create a Post Type that mimcs the Users so you can use this information to create more complex relationships.

Additional Roles are possible in WordPress, but not supported by Toolset.
Hence the only you could do to differentiate a user (president, etc) is to use user Fields (many) or Roles (one each user only).

Your initial request mentioned Post Types:

I will have several CPTs. Here they are, and here is their relationships.

1) SPORTS - I will have many SPORTS (basketball, football, etc..)
2) LEAGUES - I will have many LEAGUES. Each LEAGUE will belong to a SPORT
3) TEAMS - I will have many TEAMS. Each TEAM will belong to a specific LEAGUE
4) PLAYERS - I will have many PLAYERS. Each PLAYER will belong to a TEAM or several TEAMS

I think you need both. The post type and the Users.
So you can use the information of the users as "players" in the Post type.

It is possible, with custom code, to create Posts each time a User is registered.
I can pint point to some threads if you wish to create such a code.

The fine-tuned control over who can edit what - depending on multiple roles, or even just fields, is not possible in Toolset Access at this moment.
I filed a feature request for this - but this has no ETA yet.

For now, the possibilities are limited to what is elaborated above.

With the new Toolset Releases, such structures will become much easier to create.