Hi,
I had to stop programming for a period, and I now need to continue on a former support issue.
https://toolset.com/forums/topic/cpt-editable-by-spesifique-users/
I have made a user registration form: hidden link and connected a custom field (Firma In English: Company) to this form. Now I wonder how I can make sure only users associated with this company can view company spesifique posts.
I have now added a User field, but I am not able to connect this field to the posts. Ref: "I think the simplest option is to add a custom field that holds a Company ID in the User profile, and add another custom field that holds the Company ID in each post."
What am I missing here?
Hello,
I have checked the URL you mentioned above:
hidden link
It is empty in content area, please check it.
I suggest you follow our document to setup the relationships between posts/company/users:
https://toolset.com/documentation/post-relationships/how-to-create-custom-searches-and-relationships-for-users/
For example:
1) Create three post types:
- Companies
- Company posts
- Members
Each member post's author is different WordPress user
2) Setup two post type relationships:
- One-to-many relationship between "Companies" and "Company posts", for example the relationship slug is "ompany-company-post"
- One-to-many relationship between "Companies" and "Members", for example the relationship slug is "company-member"
3) Create a WordPress page "My company posts", in this page, you can setup a post view:
- Query "Members" posts
- Filter by:
Post author is the same as the logged in user
https://toolset.com/documentation/user-guides/views/filtering-views-query-by-author/
- In view's loop, you can use a content template "company-info" shortcode to display the parent company information:
[wpv-post-body view_template="company-info" item="@company-member.parent "]
https://toolset.com/documentation/user-guides/views/views-shortcodes/item-attribute/
4) In content template "company-info", you can display a post view:
- Query "Company posts" posts
- Fitler by the post type relationship between "Companies" and "Company posts": company-company-post
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-many-related-items
- In view's loop, display "Company posts" information.
Hi Luo,
This is almost beyound my capabilities... I need som more help here, and I truly hope this is possible to solve.
Would you mind logging in as a user? This way I can explain the full consept. It is rather complex.
If logged in (I´ll provide user details upon your response), go to this page: hidden link There you will see individual post - sortable by unique custom fields. These individual posts should only be visible to members of company A.
If logged in from company B they should have the same experince, but only with post belonging to their company.
****
There will be a lot of individual posts. So maybe I need to make some hierarky here?
Please backup your website first(I might need to deactivate other plugins/theme), and fill below private message box with test website credentials, thanks
Thanks for the details, I can login your website, but it isn't in English.
There are lots of post types in your website, which one is the "company" post type? which one is the "member" post type?