This support ticket is created 7 years 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.
I am trying to:
users can edit part of their user-fields. I made these user-fields by code (several years ago). All of them show there value, except one.
I visited this URL: hidden link
You need a login:
testabonnee
uOJ*SF&f
I expected to see:
all the fields filled with their value
Instead, I got:
one value is missing: Straatnaam.
And when you don't fill it in again, the original value is being removed.
See pictures from the same user, backend en frontend.
The site is in dutch.
Straat en Straatnaam is the same.
I couldn't see anything with the login details you provided, the subscriber role has insufficient rights.
Am I to understand that you have created custom User Fields not with Types, and you want to be able to use these in a CRED user form?
For non-Types fields you would need to use generic fields in the form, and if you want the values saved to the database you would need to add "persist":1 to the field options.
If that's not the case can you clarify how the user field was created and how you are adding it to your CRED form?
Then in toolset creds I made a form > Edit existing user
In this form I use this code:
<div class="cred-field cred-field-straatnaam driekwart">
<label class="cred-label">
Straatnaam
</label>
[cred_field field='sdz08_Straat' post='user' value='' urlparam='']
</div>
I can insert these fields with the button "add user fields". The strange thing is, that I see the Straat-button twice. But both generating the same code:
[cred_field field='sdz08_Straat' post='user' value='' urlparam='']
I used your code to set up the user fields on my own site and then registered those fields for use in CRED (if you go to Toolset > User Forms you will see a button to Manage non-Toolset User Fields that you can use to define the type of these fields—e.g. single line text field—and specify they should be added to the form scaffolding).
I then auto-generated the form, and tested it on the front end and it worked as expected.
I can take a look at your site to see if it looks like it is set up correctly. It may be the case that it is necessary to de-register the fields, delete the form, re-register the fields and make the form again, but let me take a look first.
I will mark your next reply as private so that I can get log-in credentials from you—you may want to create a temporary admin user for me to use that you can later delete. And be sure to have a current backup of your site.
I have been doing quite a bit of testing and I'm struggling to account for what I find.
If I auto-generate the form markup, two versions of the same field are added (sdz08_Straat and sdz08_straat), and completing and submitting the form entries for sdz08_Straat and wpcf-sdz08_straat are added to the wp_usermeta database table, neither of which are displayed when the form reloads.
I have had to seek a second opinion from colleagues and am awaiting their reply.
The settings for the user custom fields are stored in wp_options under wpcf-usermeta, and looking at that entry on your site, for some reason there is an entry for both sdz08_Sraat and sdz08_straat.
I'm not sure how that came about, and whether it is something to do with directly registering the custom user fields outside of Types, but the problem with the Straat field not being saved seems to be fixed editing the wpcf-usermeta field in wp_options directly and changing the single occurrence of sd08_straat to sd08_Straat.
I tried that on my local copy of your site and it worked.
Are you comfortable using phpMyAdmin to edit your database contents to make that single change?
If not I can try and do it for you.
In any case, whoever does it, be sure to make a back up first in case something goes wrong.