Skip Navigation

[Resolved] Hooks for CPT in types

This support ticket is created 5 years, 1 month 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
- 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/Karachi (GMT+05:00)

This topic contains 3 replies, has 2 voices.

Last updated by Waqar 5 years, 1 month ago.

Assisted by: Waqar.

Author
Posts
#1203203

I'm creating my membership site.. each user will relate to a member directory (one to one relationship)

based on documentation here: https://toolset.com/documentation/post-relationships/how-to-create-custom-searches-and-relationships-for-users/

i can't relate a user with post type, so i will create another CPT called Member.

With this setup, there's one thing i would like to ask

Is there any hooks that i can use so when people update their names, it also update their name field in the Member CPT.

Thanks

#1203756

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Viktor,

Thank you for contacting us and I'll be happy to assist.

There is no direct Toolset hook or filter available which can update the information in the user's "Member" CPT, when he/she updates the user profile.

Can you please let me know, why you need to store member's information separately in a "Member" CPT? It is possible to store additional information with each user's profile, directly using the user fields:
https://toolset.com/documentation/user-guides/user-fields/

If you'll use a single entity (user profile), for storing each member's information, it would save you from additional work and complications.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1204854

Well, i'm want to make a business directory that consist talent directory and company directory, i was told that i cannot create relation between user and post and need to create talent post type in order to make relation. It was redudant for user to create their name and email in the post type when they already register their data (registration is on user table, right).

What is your suggestion on this ?

Thanks

#1205569

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Viktor,

Thanks for writing back.

>> i was told that i cannot create relation between user and post
>> and need to create talent post type in order to make relation.

- You were told correct and it is not possible to connect "Users" and "Post Types" through regular "Post Relationships", because they can be formed only between two post types.
( https://toolset.com/documentation/post-relationships/ )

But having said that, it doesn't mean that you cannot link/connect users with the posts at all.

From your other ticket on the same topic ( https://toolset.com/forums/topic/relationship-between-cpt-and-user/ ), I understand that your goal is to establish a link or connection between users and companies (CPT), so that each company can have multiple users.

For this requirement, it would make sense to have a new CPT "Members", similar to how "Contractors" CPT is being used in the example guide:
https://toolset.com/documentation/post-relationships/how-to-create-custom-searches-and-relationships-for-users/

Getting back to your actual concern which started this ticket, you don't have to worry about keeping the names of "Member" CPT and user's profile in sync.

If you'll have the ID of the user's "Member" CPT, you can always get the name from that post's author profile.

Point to remember here is that for each user's profile, a single "Member" post will exist only so that it can be used in post relationships with other CPTs. User's information like name, email etc which already exists in the user profile can and should always be used from the user's profile and not from the member's CPT.

Hope this makes it more clear.

regards,
Waqar

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