Skip Navigation

[Resolved] Create Test From Toolset Types, Then Populate Other Post Type From Info

This support ticket is created 5 years, 8 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
- 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 1 reply, has 2 voices.

Last updated by Waqar 5 years, 8 months ago.

Assisted by: Waqar.

Author
Posts
#1219756

Hey Guys,

Ok so this issue would be a bit more on the advanced side I think...
Ok so i have 2 post types i.e. Test Templates & Tests Taken

I want users to setup tests in test templates, which has a title field, and then a repeatable group with text boxes in it... Then I want users to be able to take the tests and it to save in another post type which will be pulling data from the first.

So for example, if I have a test template with 4 repeated text boxes, it needs to create a field in the second post type, which has the template title as the question for example, and the repeated text boxes as multiple choice answers in a radio button

How can this be done?
Basically i need a dynamic form to the fullest

#1220212

Hi Marcel,

Thanks for asking! I'd be happy to help.

Your understanding is correct and this will require custom programming.

To insert/save a new post type, when a form for the first one is submitted, you can hook your custom function to "cred_save_data":
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data

When your custom function will be executed after the form's submission, you'll have the ID of the newly inserted post, as shown in the example snippets in the documentation.

You can use that ID to get information like title or custom fields data and insert/publish a new post using WordPress' "wp_insert_post" function:
https://developer.wordpress.org/reference/functions/wp_insert_post/

I hope this helps and for more personalized assistance around custom code, you can hire a professional from our list of recommended contractors:
https://toolset.com/contractors/

regards,
Waqar