Skip Navigation

[Resolved] Gravity Forms and Post Relationships

This support ticket is created 5 years, 6 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 1 reply, has 2 voices.

Last updated by Nigel 5 years, 6 months ago.

Assisted by: Nigel.

Author
Posts
#1235360

Tell us what you are trying to do?

I'm trying to use a Gravity From to create a Child Post (student) from a specific parent.

I can pass the id of the parent (school) through the 'Create Child Post Link' option in 'Toolset Forms' shortcodes.

I can save the parent id in the Gravity Form, but am having trouble using it to connect the child post to the parent post.

Is there any documentation that you are following?

I've been following some old (2012) posts and this post - https://toolset.com/forums/topic/saving-a-relationship-when-creating-a-post-via-gravity-forms-custom-post-type/ - but they don't appear to work.

I've tried the snippet from this post as well - https://toolset.com/forums/topic/gravity-forms-relationship-issue/

I've also tried connecting the parent id using the custom post meta option within Gravity Forms.

So what I have is:

I know the parent id I want to link to, and that has been passed successfully into the Gravity Form

I can create the child post successfully

BUT, I can't connect the two like I can with the relationship field in a CRED form. I can't use the Cred form because I need the functionality of the Gravity Form (Mailchimp etc.)

Thanks,

#1235423

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Lucy

When you use a Toolset Forms it handles making the connections automatically when the form submission is processed.

If you are using Gravity Forms you will need to make the connection manually.

Types relationships changed significantly with the move to Types 3 and older forum posts won't help you.

You need to use the relationships API function toolset_connect_posts to make the connection: https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_connect_posts

I assume that Gravity Forms has a hook available for when the form is submitted that you can use to trigger the required code, but you'll need to check the GF documentation for details as I'm not familiar with it.