I am setting up a Business Directory. Ideally, I would like to gather information from a form - and use it to complete the fields in my custom post type... while also setting up the submitter as the user assigned to that particular custom post (for their business) .
Hello and thank you for contacting the Toolset support.
A single Form can be configured to create or edit one Post, or create or edit one User...but not both at the same time.
If you want to register a new User and create a post in one Form, it will require custom code with PHP and the Forms API. Generally, these are the steps:
- Create a New User Form that includes all the User field information you want to capture for registration.
- Insert generic fields to capture each of the Business/Organisation fields: https://toolset.com/documentation/user-guides/inserting-generic-fields-into-forms/
- Add some custom code with the Forms API cred_save_data to collect the information from the generic fields, and store that information by programmatically creating a Business/Organisation post. You can set the new User as the Business/Organisation post author to connect the User and the new Business/Organisation. We have documentation about the cred_save_data API available here: https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data
...and information about creating a post programmatically on the WordPress site: https://developer.wordpress.org/reference/functions/wp_insert_post/
I'm not sure of your skill level with PHP, so this is just a basic overview. Let me know if you have questions about this process and I can offer more guidance.
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.