Please i need some help.
How to make that some fields are auto filled based from the logged in user?
John is from Alaska
Robert is from California
in the forms have field with name LOCATION
- When John logged in, field LOCATION auto filled to Alaska
- When Robet logged in, field LOCATION auto filled to California
Thank you for your help.
For a logged in user, you can use the user merge tag to set the ‘Default Value’ for form fields. So for your users, let’s assume you stored their Location in a user meta field called ‘location’. When the user logs in, you can use any of that information from their user meta (profile.) If you want to populate a field in the form with their location, use this merge tag as “Default Value” for the field:
If you had information about their favorite restaurant stored in a user meta field with a meta key of ‘fav_restaurant’ you could use this merge tag for default value of a field to retrieve and show that data:
Let us know if you need more assistance with that process.
Sorry, I still do not understand from your explanation … sorry I do not understand about “merge tag”.
Can you give an example of how to use it?
sorry in advance because I am still a newbie.
Sure. First, take a look at this documentation:
That explains the merge tag usage.
This is a merge tag:
You can use that merge tag as the “Default Value” for any field in the form builder. Go to the Advanced Tab of the field, and enter that merge tag in the Default Value input and save the form.
When a logged in user visits the page with the form on it, that field will be pre-filled with the information stored in their profile (user meta) with a meta key of
location. If you have information stored with other meta keys, use those keys in place of
location in my example.
Let us know if you have any other questions.
did you mean their profile in database WP wp_users? i cannot find column location.
so I just use the column user_activation_key, although I have to input it one by one.
That’s not right at all…
No, the wp_usermeta table. There will be a column meta_key. That is what you use in the user merge tag, like this:
Here’s some wp_usermeta for one user:
location into a form field, I would use this merge tag as “Default Value” (on the Advanced tab):
When the form is shown, the information from the logged in user’s profile (wp_usermeta) is shown in the form field already:
Let me know if you need more assistance with that.