Skip Navigation

[Resolved] Need confirmation on cred_sucess_redirect (bug on documentation ?)

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

Last updated by Pat 5 years, 7 months ago.

Assisted by: Minesh.

Author
Posts
#1253899

Pat

Hello,

I'm using cred_success_redirect and have found an issue in the documentation :
When you look at the definition, it says that argument is :
form_id. The form ID.

In the example, we can find this :

add_filter('cred_success_redirect', 'custom_redirect',10,3);
function custom_redirect($url, $post_id, $form_data)
{
    if ($form_data['id']==12)
        return '<em><u>hidden link</u></em>';
   
    return $url;
}

In the reality, I have tried both :
if ($form_data['id']==12)
and if ($form_data['form_id']==12)
and none of them works.

I can make it work only by passing the Cred ID thnaks to the function title :
add_filter('cred_success_redirect_12', 'custom_redirect',10,3);

Can you clarify this point and confirm the way of using it.

Thanks
Pat

#1254069

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Well - I've just rested the following code with one of my form and once I submit the post the page is successfully redirected to hidden link as I configured with cred_success_redirect hook.

add_filter('cred_success_redirect', 'func_custom_redirect',10,3);
function func_custom_redirect($url, $post_id, $form_data){
    if ($form_data['id']==1622){
		
        return '<em><u>hidden link</u></em>';
	}
   
    return $url;
}

I do not see any issue as you suggested. However, yes to check the form ID you need to use $form_data['id'] instead of form_id.

#1256935

Pat

Hi Minesh,

So, that means the documentation on the Toolset Forms API is not updated (see https://toolset.com/documentation/programmer-reference/cred-api/#cred_success_redirect) where it is still indicated that we need to use the form_id !
I'm closing this ticket as we can follow up thanks to another opened one (https://toolset.com/forums/topic/how-to-avoid-the-url-message-after-cred-submission)
Regards
Pat