Problem:
Save CRED generic field into custom user field, for example:
generic field:
[cred_generic_field field='company' type='select' class='' urlparam='']
{
"required":0,
"validate_format":1,
"persist":1,
"default":[],
"options":[ [wpv-view name="cred-companies-as-json-list"] ]
}
[/cred_generic_field]
Save it into custom user field "user_company", which is created with Types plugin
Solution:
I suggest you try with CRED action hook cred_save_data to save the cred_generic_field to save it into your database.
https://toolset.com/documentation/user-guides/cred-api/#csd
This hook allows doing a custom action when post data is saved to database.
If you need update custom user field value, please try with WordPress function update_user_meta
https://codex.wordpress.org/Function_Reference/update_user_meta
For example:
add_action('cred_save_data', 'user_company_func',10,2); function user_company_func($user_id, $form_data) { // if a specific form if ($form_data['id']==20) { if (isset($_POST['user_company'])) { // add it to saved user meta update_user_meta($user_id, 'wpcf-user_company', $_POST['user_company'], true); } } }
Relevant Documentation:
https://toolset.com/documentation/user-guides/cred-api/#csd
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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 9: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/Hong_Kong (GMT+08:00)
This topic contains 6 replies, has 2 voices.
Last updated by Tristian 7 years, 9 months ago.
Assisted by: Luo Yang.