Skip Navigation

[Resolved] Can I use forms to BOTH add content AND register a user in one submission?

This support ticket is created 4 years 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: Africa/Casablanca (GMT+00:00)

This topic contains 1 reply, has 2 voices.

Last updated by Jamal 4 years ago.

Assisted by: Jamal.

Author
Posts
#1563343

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) .

Possible? Or back away from the keyboard?

#1564043

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+00:00)

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/

Another ticket here you may find useful: https://toolset.com/forums/topic/auto-create-custom-post-after-new-user-submission/

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.