Skip Navigation

[Resolved] The best way to have a list of names related to a role related to a project

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.

Our next available supporter will start replying to tickets in about 1.75 hours from now. Thank you for your understanding.

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)

This topic contains 7 replies, has 2 voices.

Last updated by Minesh 8 months, 2 weeks ago.

Assisted by: Minesh.

Author
Posts
#2683465

I have a CPT called "Films", a CPT called "CrewMember" and a CPT called "Roles"

On the film page I need to display the actors list, the director, the producer list

On the CrewMember page I need to display the list of the roles in "the movie names"

For example: The page of ANNE HATHAWAY

ACTOR
Celine in "Mothers' Instinct"
Patricia Jessup-Lauddem in "She came to me"
Rebecca in "Eileen"

PRODUCER
"The Idea of You"
"The Lifeboat"

Then I click to the name of the movie I need to go to the movie page which is displaying a column with all the actors and another with all the other roles.
In this last column I need to display "PRODUCER" and the name of the producers of this movie, "DIRECTOR" and the name(s) of the director(s).

So I need to cross all the data and move to the page of all the relations and being able to display the sorted roles with their related names (crew member)

What is the best way to do that ?

I currently do it like this:

A role is defined by a few checkboxes like "actor", "director", "producer", etc... If Actor is check then I can enter the name of his role in the movie.

I have a One to Many relationship between the CrewMember and the Roles (as he can be actor on one film and director of another, or both)
I have a One to Many relationship between Film and the Roles (as there is many roles in a film).

I was wondering if it's the best solution or if there is a better way to do it ?

#2683747

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Please allow me to review your current requirement and I will get back to you as soon as possible.

#2683748

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Please allow me to review your current requirement and I will get back to you as soon as possible.

#2683750

Thanks a lot Minesh !

#2684097

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

The optimal way to do this would be a many-to-many relationship between Crew and Films, where Roles was specified via the intermediate post type as a relationship field.

So to demonstrate with your example:

- "Anne Hathaway" (Crew) could connect to the Film "Mothers' Instinct" where the Role field was "Actor" (and the character name would be stored in another field).
- "Anne Hathaway" (Crew) could connect to the Film "She came to me" where the Role field was "Actor" (and the character name would be stored in another field).
- "Anne Hathaway" (Crew) could connect to the Film "The Idea of You" where the Role field was "Producer"
etc.

But - here the disadvantage is:

Toolset doesn't support connecting the same posts more than once, so if the Crew member had more than one role in the same film (e.g. Actor and Executive Producer) this wouldn't be a viable option.

However - You can make multiple relationships involving the same post types.

In that case you will require many-to-many post relationship per role you have.

- To connect Crew Members to Films in a "Actors" relationship (specifically to record connections for Actors), and another Crew Members to Films relationship for "Producers", and others for each role.

So,
- One many-to-many post relationship with post types "Crew" and "Films" for Actors with relationship name "Crew Films Actors" and add your required custom fields to relationship
- One many-to-many post relationship with post types "Crew" and "Films" for Producers with relationship name "Crew Films Producers"
- One many-to-many post relationship with post types "Crew" and "Films" for Authors with relationship name "Crew Films Authors"

Another way I think of is plan B:
- You should have Films, Crew and Roles setup as post types
- Create a one to many post relationship between Films and Roles
- then to the Films post type add a repeating field group where you should add one select field for "Crew", another select field for "Role" and one single line field where you record the information about job-description for the selected crew and role for this pair

But having said that this will be the workaround and needs the use of filters to pre-populate the select fields for "Crew" and "Roles" select boxes.

If you want please let me know if you want to see how it works with plan "B" and I will be happy to demonstrate you the plan "B" structure but it will has its own advantages and disadvantages.

I hope this helps you to understand how you can setup your structure.

#2684279

Hi Minesh !

Thanks a lot for these explanations. Is plan A cleaner/more flexible than plan B ?
As the Actors need to be recorded with their roles (intermediary) and the other crew members only with their "function" isn't the solution A better ?
To avoid the issue of post connected more than once, what if I make a "many to many" relationship with custom fields on the intermediary with their role names for the actors and have only a 2nd "many to many" relationship with 1 custom field ("checkboxes" with all the functions of a crew member can have or a multiple dropdown selection or multiple single checkboxes).

Is it still a clean, flexible and reliable solution ?

#2684280

In any case for another part of the site I would be interested by you demonstration of Plan B and the related filters to make it work.

#2684355

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Thanks a lot for these explanations. Is plan A cleaner/more flexible than plan B ?
==>
As shared before each plan has its own advantages and disadvantages. Plan A would be more easy for you where with plan B you will have to add/use some custom code.

As the Actors need to be recorded with their roles (intermediary) and the other crew members only with their "function" isn't the solution A better ?
===>
Yes - this could be better.

To avoid the issue of post connected more than once, what if I make a "many to many" relationship with custom fields on the intermediary with their role names for the actors and have only a 2nd "many to many" relationship with 1 custom field ("checkboxes" with all the functions of a crew member can have or a multiple dropdown selection or multiple single checkboxes).
==>
You can not build post relationship with intermediary posts as its not allowed by design.

Is it still a clean, flexible and reliable solution ?
===>
Here is a sandbox site and you can auto-login to it using the following link:
- hidden link

You can try to build your required structure like post types, custom fields, views etc..etc and play with it and check what structure suits your needs the best.