Skip Navigation

[Resolved] How can I apply the same custom field to post fields and user fields?

This support ticket is created 4 years, 6 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 1 reply, has 2 voices.

Last updated by Christian Cox 4 years, 6 months ago.

Assisted by: Christian Cox.

Author
Posts
#1356391

Tell us what you are trying to do?
I have a Parent/child relationship set up, but I need to track an account ID across several custom posts, including the User Post. How can I accomplish this?

Basically, here's what I want:

I set up a new customer, and they get an Account ID. I have a custom post type, "Account" that stores information about the account, including the Account ID (which is the account post ID). Then, I have Teams. Teams are set up as a parent/child relationship. Teams also need the Account ID. Then I have Players. Players need the Team ID but I also need the Account ID at the Player level. Finally, I have specific data set at the WordPress User level that can be shared across multiple Accounts > Teams > Players and so I need a repeatable field on the User post for the Account ID. This is where I'm stuck. I can't add the Account ID to any of the tables in the custom posts if it's listed in the User tab and visa-versa. Am I missing something?

Ideally, I want this:

Company- Company has a COMPANY ID

Team - teams have the COMPANY ID and a TEAM ID

Team Member - team members have the TEAM ID and the COMPANY ID as well as a WordPress User ID

WordPress User - WordPress users have a repeatable field for COMPANY ID

Is there any documentation that you are following?
I've read a few posts, but they're outdated.

Is there a similar example that we can see?

What is the link to your site?
hidden link

#1356461

This is where I'm stuck. I can't add the Account ID to any of the tables in the custom posts if it's listed in the User tab and visa-versa. Am I missing something?
No, that's expected. User fields, by definition, cannot be used as post fields. They are stored in different database tables and are linked to User Profiles, not custom posts. Generally speaking, it's better to manage information in only one location instead of trying to store it in all the different post types and User profiles, then update all those locations when the data changes. Toolset's post relationships feature can help here: https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/

I need to track an account ID across several custom posts, including the User Post.
I'm not sure exactly what you mean by tracking, but it sounds like you want to be able to display information from related posts and possibly User Profiles, from the context of other related posts. We have some information available that describes how you can link each User to one post in a custom post type (a proxy post), then use that custom post type to establish post relationships:
https://toolset.com/documentation/post-relationships/how-to-create-custom-searches-and-relationships-for-users/
When you create relationships between posts, you can then access information from related posts using Types field shortcodes. By establishing a link between the post and the User profile (as post author), you can access that account ID in the author's User Profile from the context of any of the related posts.

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