Hi there
I'm following this solution here https://toolset.com/forums/topic/passing-parameters-and-values-in-cred-form-submit/#post-1264923 to pass the field values of a CRED form in the URL for another form (not toolset) to automatically populate some of the fields there.
add_filter('cred_success_redirect', 'custom_redirect',10,3);
function custom_redirect($url, $post_id, $form_data){
if ($form_data['id']==5092)
return 'xyz.com/form/?vn=first_name&nn=last_name&st=user_strasse&pl=user_plz&or=user_ort&em=user_email&ug=user_email';
return $url;
}
The parameters work fine, the only issue is that instead of the content of the field, only their names appear in the URL. I understand that the current code isn't made for that. I assume in the thread linked above they fixed that issue, but I'm not able to follow that. Can you give me a hint on how I can get the values of my seven custom fields in to the URL?
In case it's relevant: this is a user form (to create users).
Thanks a lot for your help!

Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
Hello. Thank you for contacting the Toolset support.
Can you please show me where exactly you added the Toolset form and share the admin access details so I can review your custom fields and the share the solution.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.

Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
Can you please test now: hidden link
I've added the following code to "Custom Code" section offered by Toolsest:
=> hidden link
add_filter('cred_success_redirect', 'func_custom_redirect',30,3);
function func_custom_redirect($url, $post_id, $form_data){
if ($form_data['id']==5092){
$user_id = $post_id;
$user_info = get_userdata($user_id);
$first_name = $user_info->first_name;
$last_name = $user_info->last_name;
$user_strasse = get_user_meta($user_id,'wpcf-user_strasse',true);
$user_plz = get_user_meta($user_id,'wpcf-user_plz',true);
$user_ort = get_user_meta($user_id,'wpcf-user_ort',true);
$user_email = $user_info->user_email;
return '<em><u>hidden link</u></em>'.$first_name.'&nn= '.$last_name.'&st='.$user_strasse.'&pl='.$user_plz.'&or='.$user_ort.'&em='.$user_email.'&ug='.$user_email;
}
return $url;
}
I can see all field values are populated with its correct values.
Hi Minesh
Thank you very much for the help! It works perfectly.
Have a nice day!
Best,
Marcial