Hi,
I think you misunderstood. The '17' and '35' are not the ID's from the CRED form. There is only ONE cred form, with ID '6'. The '17' is added as a URL parameter, so that the CRED form knows this person is writing a review for the parent page with ID '17'. Same for '35'.
So in Types the CPT 'Review' has 'Page' as parent. From this pages with ID 17 and 35 I link to the CRED form, that's why the URL parameter _parent_page_id is being added.
Now I need that when somebody filles in a review for parent page with ID 17 is being redirected to another URL then the person who is filling in a review for parent page with ID 35.
I would like to know two scenario's:
1) Redirect them to completely different pages, the one we were working on:
This is what I tried, changed 'id' to '_wpcf_belongs_page_id', but this is not working:
add_filter('cred_success_redirect', 'custom_redirect',10,3);
function custom_redirect($url, $post_id, $form_data)
{
if ($form_data['_wpcf_belongs_page_id']==17) {
return '<em><u>hidden link</u></em>';
}
if ($form_data['_wpcf_belongs_page_id']==35) {
return '<em><u>hidden link</u></em>';
}
// You can also replace above if blocks with a switch() block.
return $url;
}
2) Just like the CRED form (the is only ONE cred form), I would like to have on 'thank you page', but with again (just like the cred form) a URL parameter added. So in the setting of CRED form with ID 6 I redirect people to the page 'thank-you-for-review'.
Now, when somebody fills in a review on:
<em><u>hidden link</u></em>
I want the redirect filter to add the '?parent_page_id=17' part also to the thank you page, like this:
<em><u>hidden link</u></em>
Same for:
<em><u>hidden link</u></em>
Needs to be redirected to:
<em><u>hidden link</u></em>
Thanks.
Kind regards,
Willem