Dear Sir/Madam,
Does Toolset have any hook that I can call to create a custom post like "Student" if a new user registers as a student? Is there any hook that I can update the custom post if I update from the backend? For example, when I update the WP user's display name, once I update, then the hook will automatically update the custom post's title same as the display name, in the custom post I will have more additional information like what class the student enrolled.
Best regards,
Kelvin.
Does Toolset have any hook that I can call to create a custom post like "Student" if a new user registers as a student?
If students register using Toolset Forms, then you can use the cred_save_data or cred_submit_complete hooks to create new custom posts. There are several tickets in the forum that contain examples. You can search Google for something like "site:toolset.com automatically create post when user registers" and find examples like these:
https://toolset.com/forums/topic/automatic-post-creation-on-registration/
https://toolset.com/forums/topic/auto-create-custom-post-after-new-user-submission/
https://toolset.com/forums/topic/have-a-band-admin-role-to-manage-cpt-band-listing-page/
If the User is the author of his or her own Student post, you can use the User ID to query posts by post author to get the Student post, then use wp_update_post or update_post_meta to update the Student post details.
Is there any hook that I can update the custom post if I update from the backend?
Toolset does not provide such a hook, but the WordPress hook profile_update is available for performing actions after a User profile is updated:
https://developer.wordpress.org/reference/hooks/profile_update/
Dear Christian Cox,
Thanks for your reply. Both cred_save_data and cred_submit_complete are using Toolset form to create WP account, but how I can do the same if using standard WP registration or register by social account?
Best regards,
Kelvin.
Thanks for your reply. Both cred_save_data and cred_submit_complete are using Toolset form to create WP account, but how I can do the same if using standard WP registration or register by social account?
Toolset only provides APIs for registration workflows that utilize Toolset Forms. Standard WP registration and 3rd-party registration workflows are not covered by any Toolset APIs.
I suggest you look for solutions with built-in WordPress APIs like user_register or register_new_user:
https://developer.wordpress.org/reference/hooks/user_register/
https://developer.wordpress.org/reference/hooks/register_new_user/