[Resolved] Relationship between a WordPress user and a post-type not working
The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 6 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.
You can create Types post relationships between different post types, but nothing else.
You can't make post relationships out of users and posts.
I'm not sure what your use case is but you would normally connect posts and users using the built-in post_author field, or if that is not appropriate, then using a custom field on the posts where you store the associated user's id.
I can elaborate on that if needs be and you have some more details about what you are aiming to do.
If you want to store a User ID as a post custom field, and you want some way of selecting the user rather than manually entering the id in a text field, I would suggest you set up the custom field as a select dropdown.
There is no simple way to add the users to that dropdown that doesn't involve writing some custom code to populate the dropdown with the users and user ids.
There is an undocumented filter you can use for this: wpt_field_options.
In your case you will need to run a query that gets all the users and then uses the above filter to populate the select field options and values with the user names and user ids respectively.
If you need some more specific guidance let me know.