user_meta data assistance

By: Erik Meeder | Asked: 12/10/2024
ForumsCategory: General questionsuser_meta data assistance
Erik Meeder asked 2 days ago

I am struggling with retrieving meta_data. It seems like it is thoroughly explained but i cant see why i cant populate meta data in my hidden field.
I have a hidden field in user registration called 'User Dealer Group'. It is a field that i manually enter after a user is added; if they belong to a dealer group.  I see the entry in my 'Entries' and i have the meta data also sent to WP Users with Actions-Register User.  All seems to be good.  The name and value i use in 'Register User' action is all the same "User Dealer Group"
In one of my forms i want to populate a hidden field with the logged-in user's "User Dealer Group". i have a hidden field on that form with Default value of [user_meta key="user_dealer_group"]   i have also tried [user_meta key=user_dealer_group] and [user_meta key="User_Dealer_Group"]  since the 1st one wasn't working.  
I cannot get this field to be populated with the "User Dealer Group" when the entry is submitted buy the user.
I must be misunderstanding something. 
If anyone could assist me that would be really great.
Thanks
BTW - really loving formidable forms. i never realized so much could be done a good forms plugin. My whole website is essentially run by your plugin. Thanks a lot!

2 Answers
Walter JonesWalter Jones answered 1 day ago
Assuming that the person who is submitting the data is logged in and the user_meta exist already for that user?
Erik Meeder replied 1 day ago

i assume it exists. I 'Edit' the users entry for the registration form, filling in the User Dealer Group field. Because it is hidden to him on the registration page. Similar to the User ID. i just cant seem to use this field on subsequent forms that the user completes. i hoped to be able to call it using meta_data key for the logged in user

Victor Font answered 1 day ago
I'm confused by your question. You say "it is a field that i manually enter after a user is added". I'm not understanding your expectation when you say "I cannot get this field to be populated with the "User Dealer Group" when the entry is submitted buy the user."   If you're populating the field manually, how can you expect it to be populated by the user as well?
Erik Meeder replied 1 day ago

A new user submits a registration in the registration form. There is a field there that remains blank and is hidden on the registration form. I then enter the 'user dealer group' that i want him to belong to. Then in his profile he has this field available to be called using meta_data key.

Then in other forms that this user completes when he is logged in, i want this [meta_data key="user_dealer_group"] to populate in a hidden field with the user logged in data. Very similar to the way User_ID is recorded in forms

Victor Font replied 1 day ago

You have a couple of things going on here. When the user submits the form, the hidden field is empty. Formidable does not store empty fields. That being the case, when the user submits the form the user meta is not being updated with an empty field either. You haven't saved anything when the user submits the form. When you edit the form, that's the first time you're adding the value to the record. Is the "Trigger this action when" selector in your Register User action set to "Entry is created, Entry is updated"? You already have the right idea about setting the default value going forward. Hope this helps.

Erik Meeder replied 1 day ago

The trigger is "Entry is Updated". A user is not registered unless i approve them. I think that's why i had it set like that.
But either way, i can see that the data for that field after i edit it (when new user has submitted registration form), I see that the data also shows in the entry detail for that user, and it also is updated in the WP Users details. So it seems that the data is there in this field for this particular user.
Am i correct that the data in the field name 'User Dealer Group' should be called using [user_meta key="user_dealer_group"] ? Do i have the proper code for that? Is my choice of field name not ideal because it starts with 'user_' perhaps?

Victor Font replied 13 hours ago

Your using the proper shortcode. Make sure you're using the right meta_name

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right