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.
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.