Skip Navigation

[Gelöst] How to relate a CPT with the WordPress users

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

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

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)

Dieses Thema enthält 3 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von Luo Yang vor 7 Jahre, 11 Monate.

Assistiert von: Luo Yang.

Author
Artikel
#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/

Dieses Ticket ist jetzt geschlossen. Wenn Sie ein Toolset Kunde sind und Hilfe benötigen, eröffnen Sie bitte ein neues Support-Ticket.