Skip Navigation

[Resolved] cred_success_redirect on "draft" post.

This support ticket is created 7 years, 2 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 4 replies, has 2 voices.

Last updated by tinaH 7 years, 2 months ago.

Assisted by: Minesh.

Author
Posts
#490948

I am trying to use a CRED hook to reload the current page after a form is submitted.
Use the code below (found here in the support forum) on several forms and it works unless the post status is "draft".

Can you please help me alter the code so that it works on forms that creates posts with status "draft".
(don't know php...)

/* reload current page after new post */
add_filter('cred_success_redirect', 'custom_redirect',10,3);
function custom_redirect($url, $post_id, $form_data)
{
	 if ( in_array($form_data['id'], array(3856, 3684, 5190, 5202, 5080) ) )  //Form IDs
        return (parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
  
    return $url;
}
#491090

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Could you please share screenshot of your CRED from so that I can review the settings of your form?

#491507
custom redirect.png

The form creates a child post with status published.
It is placed on the parent post page.
The parent has status draft.
The custom redirect works if parent post is published but not if it is a draft.
Wonder why 🙂

#491616

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - only users with admin rights can see the draft posts and its not logical to redirect the user to draft post at all. Visitors should able to see the published posts. I would suggest you correct the settings.

Also - its not correct that you set the draft post as the parent. The post type relationship should be maintained by following the normal process that means parent post should be published.

#493459

OK understood 🙂

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