I am trying to capture logged in user info, his userid, using a hidden field in Toolset form and saved it as custom fields for CPT.
I have a custom post type name: Diver sizing and custom fields group assign to this CPT.
I want a Logged in user to be able to submit a form for equipment sizes. So I need userid to be captured in the form. I have put custom field-slug in the hidden field slug and in the value I have put shortcode [wpv-user field="ID"].
When I test this out, it is not captured. and another issue I have is that everytime the form is submitted, the CPT post saved but with blank on the userid and the post title become CREDAutodraftxxxxxxxxx.
1. How do I pass the value from hidden field in the form to custom field.
2. How Do I use the hidden field as the post title when user submit the form.
Thank you for your kind assistance.
Hi,
Thank you for contacting us and I'd be happy to assist.
Your approach of using the "wpv-user" shortcode to pass on the current user's ID is correct and should work.
To troubleshoot and suggest the best way to achieve both these points, I'll need to see how this form is set up in the admin area.
Can you please share temporary admin login details along with the link to the page with this form?
Note: Your next reply will be private and it is recommended to make a complete backup copy, before sharing the access details.
regards,
Waqar
Hi Waqar.
My issue is resolved now. Thank you!
I realized that if the field is hidden especially for the post title the value will not be recorded.
So i found a workaround by using CSS to hide the custom field that initially using hidden form field and place the wpf-user info as default value. And when i test this solution when form is submitted by user, all the data is captured into CPT.
Thanks