Tell us what you are trying to do?
So Far:
I am have 3 post types. PERSONNEL, COMPANIES, PROJECTS.
Each PERSONNEL post is connected to only 1 WP USER
COMPANIES and PERSONNEL have a 1-1 relationship
COMPANIES and PROJECTS have 1-MANY relationship.
PERSONNEL and PROJECTS have a MANY-MANY relationship
I'd like to have PROJECTS connected to PERSONNEL [through] COMPANIES.
For Example:
I add a WP USER and connect it to a PERSONNEL post through author name.
During PERSONNEL creation process, I should be able to select the COMPANY and choose PROJECT from the PROJECTS associated with that COMPANY.
Now when the WP user logs in, they only see the company and the projects they are associated with.
Is there any documentation that you are following?
https://toolset.com/forums/topic/creating-client-portal-would-like-to-associate-users-with-content-etc/
Is there a similar example that we can see?
not that i can see
What is the link to your site?
Local
Hello,
Yes, it is possible to achieve what you mentioned above when you create the "PERSONNEL" post in WP admin side:
During PERSONNEL creation process, I should be able to select the COMPANY and choose PROJECT from the PROJECTS associated with that COMPANY.
you just need to setup the post types and relationships as you described above:
Each PERSONNEL post is connected to only 1 WP USER
COMPANIES and PERSONNEL have a 1-1 relationship
COMPANIES and PROJECTS have 1-MANY relationship.
PERSONNEL and PROJECTS have a MANY-MANY relationship
After user logged in, you can show him a page, for example, "My account".
In this page, display a nested views:
a) Parent post view:
- Query "PERSONNEL" posts
- Filter by post author is same as logged-in user
https://toolset.com/documentation/user-guides/views/filtering-views-query-by-author/
- In view's loop, display below child view A + B
b) Child post view A:
- Query COMPANIES posts
- Filter by post type relationship between post types COMPANIES and PERSONNEL
- In views loop, display the COMPANIES post information
c) Child post view B
- Query PROJECTS posts
- Filter by post type relationship between post types PERSONNEL and PROJECTS
- In views loop, display the PROJECTS post information
More help:
https://toolset.com/course-lesson/displaying-related-posts/
Hello Mr. Luo,
Thank you for your response.
BACK END:
Speaking only about the back-end. When i create PERSONNEL, i need to connect them to a COMPANY and PROJECTS associated with that company only.
ie. when i select COMPANY 3. I need to only have the option to choose PROJECTS that are associated with COMPANY 3.
I am hoping this will avoid errors like wrong PERSONNEL associated with a PROJECT that is not part of their COMPANY.
FRONT END:
when i try to create a nested loop in the front, it says nested loops are not supported.
perhaps i don't need a nested loop on the front end, since the front end will not be used to create relationships. I am hoping to use the front end only for form creation and for updates about the PROJECTS, however all the COMPANY/PROJECT creation can be done on the back-end for now.
For the new questions:
Q1) When i create PERSONNEL, i need to connect them to a COMPANY and PROJECTS associated with that company only.
There isn't such kind of built-in feature within Toolset plugins, all options should be available by default.
Q2) FRONT END
You can try to setup post views with classic editor, for example:
Dashboard-> Toolset-> Settings-> General
in section "Editing experience", enable option "Show both the legacy and Blocks interface and let me choose which to use for each item I build".
Dashboard-> Toolset-> Views, setup those two post views, and test again.