Skip Navigation

[Resolved] How to link user with custom type

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

This topic contains 1 reply, has 2 voices.

Last updated by Beda 6 years, 8 months ago.

Author
Posts
#750629
Schermata 2018-04-27 alle 17.48.00.png

Hello,
I created a custom type called "Accomodation" and would like to link it to the type of user wordpress.
I will try to explain myself better. As shown in the attachment, I created a new select field through which I would like to choose accomodation value I want to link to the user. The goal is that I would like list to be automatically popular with all existing accommodations. Instead I can't, and in the picture I inserted two accommodations manually.

Please could you help me reach my goal?

N.B. In the Accomodation type, I can choose author that coincides with the user and this creates a link one-to-many that is ok, but what I would also need is to be able to select an accomodation owned by the user. (link one-to-one).

Thank and best regards,
Danilo.

#756389

It is not possible within WordPress to link Users to Posts other than with the Authorship.

What you can do is populate either Custom Fields or even a Post Type with the exact data as the users feature.
It will be practically a "mirror" field or post type of the User.

Then, this can be connected to other post types as you wish and you can create connections (even many to many with the latest Toolset RC).

This is the only way to "connect" users to posts I know when you use Toolset.

It will require Custom Code if you plan to not populate the data manually but have a code in place, that on every creation or editing of a user, updates the posts or fields related to it.

Such custom code is above the scope of Toolset, and I suggest, if you require help with it, to consult this with a contractor:
https://toolset.com/contractors/