Skip Navigation

[Resolved] prefield fields with user details

This thread is resolved. Here is a description of the problem and solution.

Problem:

The issue here is that the user wanted to pre-populate their post custom fields on their frontend form with their current user's custom field so they won't have to re-enter the data.

Solution:

You can pass the shortcode for that user field into the value attribute of the Form field to pre populate it.

An example of the user field code it.
[types usermeta='field_name' current_user='true'][/types]

Just replace field_name with the actual slug of your custom field.

This support ticket is created 3 years, 7 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 7 replies, has 2 voices.

Last updated by shirlyk 3 years, 7 months ago.

Assisted by: Shane.

Author
Posts
#1764175

Tell us what you are trying to do? i want to use user information (first name, id number....) as a prefilled fields in a post form. for example: a user fill only once his private information. and then - every time he submit a post form - his privat info is written there and submitted as the value of one of the fields.

the idea is that a person will not need to enter the same information every time he submit a form (name, last name...) and this info would only be filled once.

#1764355

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Shirly,

Thank you for getting in touch.

Actually you should be able to do this by pulling the user's custom meta.

I'm assuming that the first name is the default field for the user and id number is a custom field.

In this case you will add the following to the value attribute of your form field.


[wpv-current-user info="firstname"]

[types field="my-field" user_current='true'][/types]

Please try this and let me know if it helps.
Thanks,
Shane

#1767057

hi, it's not exactly what i wanted. i'll try to explain the process that users are going throw my site.
first, the problem my site wants to answer: every morning parents in my daycare has to fill out a "health declaration" about their child (because of Corona virus...). instead of fill out over and over the same information EVEY MORNING,
i was thinking about creating a system that parents would fill out the information ONLY ONCE in sign up, and than, every morning the information would appear in the declaration form automatically so they won't has to fill it again.

what i did?
1. i created USER FORM with cred, with all the relevent information i need them to fill every day (privat name, phone number...)/
2. i created a POST TYPE for "health declaration", and custom fields - the same as the custom fields in the USER FORM.
3. i created a POST FORM with cred, to add a health decleration.

my problem now is ho to fill automatically the fields in the POST FORM with the information from USER FORM.
i dont want them to type every day the same information. just want theme to check all the AUTOMATICALLY FILLED fields ar ok, and press "submit".

#1767069

this is the code i use:
[cred_field field='h_mechanechet' force_type='field' class='form-control' output='bootstrap' value=' [types field="mehanechet" user_current='true'][/types]']

"mehabechet" is the field from user fields i created.
"h_mechanechet" is the field i want to autofill in the cred form.

and it's not working.

#1768443

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Shirly,

Try this.

[cred_field field='h_mechanechet' force_type='field' class='form-control' output='bootstrap' value=" [types field='mehanechet' user_current='true'][/types]"]

There was a mismatch with the quotation when providing the shortcode inside the cred shortcode.

Let me know if the information starts showing up now.

Thanks,
Shane

#1768535

thank you,
unfortunatlly it's still doesn't work.

#1768545

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Shirly,

Would you mind allowing me to have admin access to the site as well as a link to the form so that I can have a look to see what is happening here.

The private fields have been enabled for your next response.
Thanks,
Shane

#1769179

My issue is resolved now. Thank you!
the syntax is:
[types usermeta='field_name' current_user='true'][/types]

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