Skip Navigation

[Resolved] How to relate a CPT with the WordPress users

This support ticket is created 7 years, 11 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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: Asia/Hong_Kong (GMT+08:00)

Author
Posts
#402550

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.

#402656

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

#403022

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.

#403033

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/

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