Skip Navigation

[Resolved] Include user meta fields

This support ticket is created 7 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

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 7 replies, has 2 voices.

Last updated by Luo Yang 7 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#552347

I am trying to: include usermeta on the edit user cred form

I expected to see: i tried using the 'generic field' and used the field "billing_address_1". is blank and doesnt save data to user.

Instead, I got: I also tried <wpv> but only get the logged in user data

#552387

Dear tims,

I assume the custom user field is created with other plugins/theme, you are going to edit it's value with CRED form, please try this:
1) Activate Types plugin, you can download it here:
https://toolset.com/account/downloads/
2) Dashboard-> User Fields,
click button "User Field Control", find the field "billing_address_1", click link "Manage with Types"
3) Edit your CRED form, click button "Add User Fields", you will find the field in section "Custom Fields"

#554135

This still created the field as wpcf-billing_address_1

#554518

It should not create new custom user field "wpcf-billing_address_1", see our document:
https://toolset.com/faq/how-do-i-convert-existing-custom-types-and-fields-to-types-control/

Please check if you have create a custom user field "billing_address_1" with Types plugin, if it is, you will need to remove it, and test again.

If the problem persists, please try this:
1) deactivate other plugins and switch to wordpress default theme, and test again
2) provide a database dump file of your website in below "private detail box", also point out the problem page URL and CRED form URL, I need a live website to test and debug. thanks

#554530

Since you provided only the website credentials, but did not provide the database dump file, so I need your permission to deactivate plugins and switch theme in your website, please backup your website database first.
And I tried the open the problem page:
hidden link
It display only a password window:
Protected site, it needs the password. please check it, thanks

#554531

Yes, permission to play.
Password: BBS2017

#554600

Thanks for the details, I am checking it in your website, will feedback if there is anything found

#554626

Here is what I found, it should be a bug of CRED plugin, and I have put it into our to-do list, our developers will take care of it.

Currently, here is the temp workaround, you can try this:
1) Add a custom user field "billing_address_1" with Types plugin, in database the field slug is "wpcf-billing_address_1", which should be able to be edited by CRED form without problem,
hidden link

2) When user edit it with CRED form, use CRED action hook "cred_save_data" to trigger a PHP function, in this PHP function, get the user field "wpcf-billing_address_1" value, and use it to update the user field "billing_address_1" value
for example, you can add below codes into your theme/functions.php:

add_action('cred_save_data','my_func_4',10,2);
function my_func_4($post_id,$form_data) {
    if ($form_data['id']== 151946) {
        $billing_address_1 = get_user_meta($post_id, 'wpcf-billing_address_1', true);
        if($billing_address_1){
			update_user_meta($post_id, 'billing_address_1', $billing_address_1);
		}
    }
}