Skip Navigation

[Resolved] Connect ninja Form Submission with custom posts

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 1 year, 3 months ago.

Assisted by: Waqar.

Author
Posts
#2523537
image1.png

Hey there,

We are trying to connect Ninja form submissions (post type = nf_sub) with Toolset created post type named as Rule. But the nf_sub post type is not visible in the Toolset Type dashboard or relationship wizard area.

Is it possible to setup a relationship in between "nf_sub" and "rule" post type using code or Toolset?

We tried the toolset_connect_posts hook but this returns the "The relationship does not exist" error which is fair because we never created it.

So, I am wondering if we can achieve one of the following?
1. Create/register/establish a relationship between nf_sub and rule post type? (check image1.png)
2. Or if it's possible to make nf_sub visible in toolset type sections so we can use it just like standard custom post type?

Thanks for your help.

#2524237

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting us and I'd be happy to assist.

The Toolset's post relationships can be created only for the post types, which are set to be 'public'.
( ref: https://developer.wordpress.org/reference/functions/register_post_type/#parameters )

But the way the "Ninja Forms" plugin registers its post type 'nf_sub', it is not set to be 'public'.

On my test website, I was able to make it 'public' (and thus available for the relationships), using the following code:


function custom_nf_sub_post_type_args( $args, $post_type ) {
	if ( $post_type == "nf_sub" ) {
		$args['public'] = true;
	}
	return $args;
}
add_filter( 'register_post_type_args', 'custom_nf_sub_post_type_args', 20, 2 );

The above code snippet can be included through either Toolset's custom code feature ( ref: https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/ ) or through the active theme's "functions.php" file.

I hope this helps and please let me know if you need further assistance.

regards,
Waqar

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.