Hello, I'm developing a little intranet to control the stocks of my company.
I have created a CPT called Inventory, with many custom fields, who stores all the hardware we have (computers, monitors, printers,...). I need to relate each of these entries with one WordPress user. I want to use the default WordPress users, not another CPT called users, because I want to give access to each one to their private user area.
The first idea was to display them in a select field, but I could not do it. This option is valid or is there some other way to relate?
Thank you in advance for your help.
Dear carlos,
I suggest you setup each wordpress user as author of the specific post, then you will be able to us Access plugin to limit the user access to their own post:
https://toolset.com/documentation/user-guides/setting-access-control/
For example privileges:
Edit own – create new content and edit content that each user has created
Delete own – delete the content that each user has created
Hello Luo, thank you for your answer, I'll consider that when I develop the control access.
By now, I have a CRED front form to insert posts in the CPT Inventory. I need to assign a user for each post, to do a relation. There is a easy way to do that? Assigning users from a select field or something like that?
Thank you.
Yes, it is possible with some custom PHP codes, you can create a custom select field, use Types filter hook "wpt_field_options" to setup the options of the select field as what you want, for example this thread:
https://toolset.com/forums/topic/relating-users-to-custom-post-types-to-pull-user-field-info-into-a-view/