Skip Navigation

[Resolved] Relationship between Clinic and Therapist

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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 8 replies, has 2 voices.

Last updated by FelipeP5703 1 year, 10 months ago.

Assisted by: Luo Yang.

Author
Posts
#2523495

Tell us what you are trying to do?
I'm trying to fully understand how I can use the relationship feature of Toolset. I have a fair understanding of how it suppose to work and I have seen some examples from the forum and course but one thing is still not clear to me.

I have individual clients who will only have one custom post. I have created a custom type (Anúncios) that includes the following custom fields: name, phone number, hours of work, description, and location. This is an individual post that a client can create, edit, and delete.

Now I also have clients that have a clinic with many therapists. One clinic has 10 therapists. It would be too much work for my client to create each individual custom post repeating the same information over and over.

How can this client create individual custom post but get the information from another custom post?
I believe this is where the Post Relationship comes in. This would be a one-to-many relationship where one is the clinic and many would be therapists. Or even a many-to-many relationship where many therapists can work in many clinics at the same time.

Now, I believe the correct way to do this is to create two custom types. One clinic and one therapist. Each would have their own forms.

Here comes my questions:
1) How to make so when the client who already has created their clinic profile replace custom fields such as phone number and location in the therapist form without having to input it manually every time?
2) Do I have to create a custom field asking if the information (custom fields such as phone number and location) is being "copied" from a clinic post and that information is pre-populated or replaced in the therapist form?
3) How to display in the content template? Can one content template distinguish between custom fields? Conditional display? If so, how?

I hope I made myself clear. If anything I will try to explain with a video.

#2523595

Hello,

I assume we are talking about two post types:
- clinic
- therapists

One post type relationships:
- Many-to-many relationship between clinic and therapists

Q1) how to make so when the client who already has created their clinic profile replace custom fields such as phone number and location in the therapist form without having to input it manually every time?

You can setup the phone number and location fields into post type "clinic", so you don't need to input those information when create the therapist posts

Q2) Do I have to create a custom field asking if the information (custom fields such as phone number and location) is being "copied" from a clinic post and that information is pre-populated or replaced in the therapist form?

As mentioned in Q1, you don't need to input those information in single therapist post

Q3) How to display in the content template? Can one content template distinguish between custom fields? Conditional display?
You can follow our document to setup the content template:
https://toolset.com/course-lesson/creating-templates-to-display-custom-posts/

For example, in the single "clinic" post, you can display related "therapists" posts with a post view:
- Query "therapists" posts
- Filter by post type relationship between clinic and therapist
- In view's loop, display therapist post information
https://toolset.com/course-lesson/displaying-related-posts/#displaying-many-related-items

#2523779

Luo, thanks for replying. I'm building the site from scratch, so I will be creating two custom post type (clinics and therapists), but I am unclear on something.

Do I have to create similar custom fields for both therapists and clinics? For example, phone number. I have to create it on both custom types since a therapist might not be associated with that clinic, she/he still needs to add their phone number. Is that correct?

#2523787

Luo, I created a video explaining where I'm confused. Hopefully I'm more clear and you could guide me to what to do.
hidden link

#2523937
Course of action.png

As I ponder about the best course of action. I created this flowchart and I was wondering if that's the best route for this challenge. If so, then I will need some guidance on how to setup if the user chooses manager.

Things I need to create:
1) User form with an additional custom field (individual or manager)
2) Three forms (one for Therapist, one for Clinic and one for the Relationship form) OR do I have to create four forms (one for individual Therapist, one for manager Therapist, one for Clinic and one for the Relationship form)?
3) My account page with a conditional statement that will show/hide forms. If the user chooses individual then show only Therapist form. If the user chooses manager then first show Clinic form then Therapist form (or do I show relationship form, that's where I'm stuck)

If you could tell me the best course of action that will not impede speed and performance of the site, I would appreciate!

Thanks!

New threads created by Luo Yang and linked to this one are listed below:

https://toolset.com/forums/topic/split-relationship-between-clinic-and-therapist/

#2524211

Q) Do I have to create similar custom fields for both therapists and clinics?
It depends on yourself, if you want to setup different phone number for therapists and clinics, you will need to create similar custom fields for both therapists and clinics

For the other new questions, please check the new thread here:
https://toolset.com/forums/topic/split-relationship-between-clinic-and-therapist/

#2524783

Luo, to put it simply, this is what I want:

Client fills the user form to register -> then if he is a manager give him access to clinic form first -> after filling every detail show therapist form -> this form should only have two field (a selector where he would choose which clinic this therapist belongs to and gallery photo for that therapist) -> on the therapist template it would show the clinics information + therapist photos.

But this same therapist template has to work for independent individual therapist. How would that work? Conditional show/hide?

Thanks and happy new year

#2526093

I suggest to create two different user roles, please check answer of the another thread here:
https://toolset.com/forums/topic/split-relationship-between-clinic-and-therapist/

#2526295

I will check the other thread for the setup I need. Thanks

My issue is resolved now. Thank you!