Skip Navigation

[Resolved] Attaching existing site users to custom posts types

This thread is resolved. Here is a description of the problem and solution.

Problem:
How to connect users and posts?

Solution:
There are three ways to connect users to posts.

The simplest and preferred method is to make the users the authors of the posts, thereby using the built-in means of connecting posts to users with no additional overhead.

There may be reasons why that is not possible, the main problem typically being that you can only assign a single author to a post.

A second option would be to create a custom field for post "owner" that stored the ID of the associated user. By making this a repeating field, you could connect multiple users.

The final method would be to make a custom post type for users which stores additional profile info for an individual user (who you make author of the post), and this custom post can then be connected to other post types using Types post relationships.

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

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 5 replies, has 2 voices.

Last updated by Nigel 6 years, 9 months ago.

Assisted by: Nigel.

Author
Posts
#617267
2018-02-19 08_10_02-Joseph Aldy _ Harvard Kennedy School.png
2018-02-19 08_10_23-Joseph Aldy _ Harvard Kennedy School.png

Hello.

I am building a website for an academic institution.

I have set up all teachers, staff, and other employees as users in WordPress.

What I want to do is set up custom profile pages for all the above users that shows their publications, courses they teach, events they're hosting or attending, media appearances, and such things. Most of the above will have to be with custom post types because WordPress doesn't have native post types for it.

Here is an example of such a site: hidden link I'll need to build pages for all the faculty that shows their bios, events they're hosting, and their publications. Example: hidden link (see the tab menu there)

What is the best way to get this set up with Toolset? Specifically, I'd like to know how to take existing users and attach them to the custom post types like "media appearances", publications, events, etc.

I am using the Avada theme.

#617365

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi there

There are three ways to connect users to posts.

The simplest and preferred method is to make the users the authors of the posts, thereby using the built-in means of connecting posts to users with no additional overhead.

There may be reasons why that is not possible, the main problem typically being that you can only assign a single author to a post.

A second option would be to create a custom field for post "owner" that stored the ID of the associated user. By making this a repeating field, you could connect multiple users.

The final method would be to make a custom post type for users which stores additional profile info for an individual user (who you make author of the post), and this custom post can then be connected to other post types using Types post relationships.

If one of these sounds better suited to your case and you need more info, let me know.

#617410

Thank you, Nigel.

Option 1 is out because multiple staff members may need to be connected to events, courses, and media appearances.

I think the last method will have to be used because I need to store additional info about the staff like their bios, social media links, and CV.

So if you could help me with that, I'd be grateful.

#617863

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

You could also store additional fields for the users with option 2 by adding custom user fields (https://toolset.com/documentation/user-guides/user-fields/).

For option 3, you would create a custom post type (e.g. "profile") that would store the additional user profile fields, being sure to set the author of the post as the user to whom the profile data belonged.

You would then connect this profile post in a many-to-many relationship with other post types such as "events", for example.

One person could speak at multiple events, and an event might feature multiple speakers.

We are in the midst of transitioning how post relationships work within Toolset—new betas are being published today—and how you do this right now is very different than how you would do it within a few weeks when the final versions of the plugins are published.

There will be a blog announcement about the new betas with links to new documentation describing what's involved, and I suggest you take a look at that and consider starting out with this new method from the outset.

(Or use option 2. The main disadvantage of this would be that when you add speakers to an event post, for example, you would need to add their user IDs, there would be no UI for entering the name of the speaker and storing the related id.)

#618113

Nice to know that things are going to get easier with the new version. Alas, I have to get this project live in a month's time. It would be easier for me if I could get access to the betas to start building right now with the new way. Is this possible? I really do not want to double my work. 🙂

#618148

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

The betas are available now from your downloads page (wp-types.com/account/downloads).

Here is the announcement: https://toolset.com/2018/02/types-views-and-cred-betas-with-post-relationships-and-repeating-field-groups/