Skip Navigation

[Resolved] Data design guidance required

This support ticket is created 2 years, 12 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
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: Africa/Casablanca (GMT+00:00)

This topic contains 1 reply, has 2 voices.

Last updated by Jamal 2 years, 11 months ago.

Assisted by: Jamal.

Author
Posts
#2030785

>>Tell us what you are trying to do?

**I seek your design advice for my application

I am creating a website to share 'Plans' with 'Members'.
The basic logic is summed as follows:

Case 1. Any registered 'Member' can create a new 'Plan'. And then they can attach other Members to that Plan.
Case 2. When any Member logs in, they can see their own 'Plans' AND 'other plans where they have been attached to.

Since we can not create a relationship between a CPT and User, I have created two CPTs as follows:

a. Plan
- plan_name
- plan_file

b. Member
- member_name
- member_email

Also created a Relationship (many-to-many) [Plan_Members]

My difficulty:
When any Member logs in, they should see a View listing which contains both of following:
1. Plans they have authored ------------- [*This is working*]
2. AND, plans which they are attached to ------------I have to bring back Plans from the relationship whose rows match the email address of the Current Logged user

The second part of the above query, I am not able to understand how to query.
Request your kind help.

-----------------
>>Is there any documentation that you are following?
Yes, I have seen and following all your examples and tutorials.
-----------------
>>Is there a similar example that we can see?
Yes.

Please consider the case of the 'Gyms and Trainers' example.
My question as analogous to this example would be: "How would I be able to allow Trainers to login on their own and see the Gyms where they have been enrolled (and also the Gyms they have created themselves)"

-----------------
>>What is the link to your site?
hidden link

I can provide access to this as and when required.

Thank you,
Srikanth

#2031645

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+00:00)

Hello Srikanth and thank you for contacting the Toolset support.

Well, to get the plans attached to a user, you need to get the Member post for the user, then you can get the plans related to this member post.

I assume that the member post author is the user, so you can get the member post with a view filtered by the author. Similar to the view where you get the plans created by the user. Then, inside of this view's loop, you can put a view that displays the plans related, using the many-to-many relationship, to the current post(member) in the loop.

Please note, that the blocks editor does not support creating a nested view inside a view yet, you will need to create the plans view separately, then include it inside the loop of the members' view(where the author is the current logged in user).

I hope this helps. Let me know if you have any questions.

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