I am trying to generate a report that will show results depending on the logged in user.
The setup
A Consultant User
a Company User
A company CPT
A requirement CPT
A requirement view.
The Consultant will create a Company in the Company CPT, and create a Company User that must be linked to the Company. Question 1: How do I manage to link a user to a company CPT entry? I would like to be able to connect multiple users to a company. For a bit more complex scenario, would it be able to have a many to many relationships? This is not critical but a nice to have.
Once this is done the consultant will then add requirements to the requirement CPT that is in a one to many relationships with the Company. Many requirements for one company.
Question 2: At this stage, I want to create a view with the requirements, however, the view must only display entries for companies the "company user" is a member of. (refer question 1)
Hello. Thank you for contacting the Toolset support.
Question 1: How do I manage to link a user to a company CPT entry? I would like to be able to connect multiple users to a company. For a bit more complex scenario, would it be able to have a many to many relationships? This is not critical but a nice to have.
==> Well - the thing is that you can build/create post-reationship between post types only. You can not include users to post-relationship. The alternate way is to set your user
The alternate way is to activate the "author" field for your post-type by editing your post type, that will give you author drop-down to select post author for your post.
Again, even after following the above method, you want to assign multiple authors per posts, again that is not possible, as WordPress does not support it by default. You need to find a custom way to assign multiple post authors. Find some plugin that fulfill your requirement.
Question 2: At this stage, I want to create a view with the requirements, however, the view must only display entries for companies the "company user" is a member of. (refer question 1)
==> Again, you can use post author filter with your view but this can be achieved once you successfully setup Q1 requirements.