Skip Navigation

[Resolved] user field not showing

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.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

This topic contains 10 replies, has 2 voices.

Last updated by corineV 6 years, 12 months ago.

Assisted by: Nigel.

Author
Posts
#521935
Schermafbeelding 2017-05-09 om 09.32.25.png
Schermafbeelding 2017-05-09 om 09.31.44.png

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.

Best regards,
Corine

#522004

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Corine

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?

#522032
Schermafbeelding 2017-05-09 om 13.00.22.png

Hi Nigel, thank you for having a look.

I created the user fields (long before Toolset) in the functions.php.

add_filter( 'user_contactmethods' , 'update_contact_methods' , 10 , 1 );
function update_contact_methods( $contactmethods ) {
$contactmethods['sdz08_Straat'] = 'Straat';
$contactmethods['sdz09_Huisnr'] = 'Huisnummer';
$contactmethods['sdz12_telefoon'] = 'Telefoon vast';
$contactmethods['sdz13_telefoon2'] = 'Telefoon mobiel';
return $contactmethods;
}

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>

<div class="cred-field cred-field-huisnummer kwart">
<label class="cred-label">
Huisnummer
</label>
[cred_field field='sdz09_Huisnr' post='user' value='' urlparam='']
</div>

<div class="cred-field cred-field-user_postcode clear">
<label class="cred-label">
Postcode
</label>
[cred_field field='sdz10_Postcode' 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='']

????

Can I send you my admin login in a save way?

#522080

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Corine

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.

#522147

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Corine

I didn't mean erasing any of your data when I suggested you might need to de-register and re-register your fields to be used with CRED.

In any case, I had a quick look at your site, but I don't want to break anything and so I'm taking a duplicate of the site that I can test locally.

When I have installed that I'll do some testing and get back to you.

#522541

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Corine

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.

I'll update you when I have more news.

#522611

Hi Nigel,
I appreciate your help!

#522888

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Corine

Just to let you know I'm escalating this thread so that our second tier can investigate further, and I will report back with their findings.

#524122

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Corine

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.

#524319

Thank you Nigel, Adriano, Mohammed,
I will try to follow your advice. But first make a backup. I'll let you know if I succeeded.

#524649

wohow, thank you all!

In dutch we say: "Search for a pin in the haystack". I could not have found this myself. Thank you so much. It works again!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.