Thread Starter
dkance
(@dkance)
Hi @aswingiri @champsupertramp @missveronicatv
I would greatly appreciate some orientation on whether there is something wrong with the above query for retrieving the “first_name” meta_key for a UM user.
I would like to insert in on an email text. It currently displays a blank space.
Thanks.
Regards.
Hello @dkance
The above-given SQL query is correct and should return the first_name of the user. I believe you are passing actual user_id where you have ‘%user_id%‘.
If you want to test if the query is working or not, you can pass the user_id of a user that exists on the database.
@dkance
First within UM you can use:
um_fetch_user( $user_id );
$first_name = um_user( 'first_name' );
Second {first_name} is a valid placeholder for UM Emails:
https://docs.ultimatemember.com/article/1340-placeholders-for-email-templates
Why do you need to code a MySQL SELECT statement?
Thread Starter
dkance
(@dkance)
Hi @aswingiri, @missveronicatv,
I used an actual user id and it came out blank.
The query code is for inserting the first_name on an automatic email booking confirmation sent using the Appointment Hour Booking plugin.
I am using a hidden field that retrieves the user first_name for that field tag that is inserted on an email text.
Not sure why it is not working.
Thanks!
Regards
@dkance I believe you are saving query results in a variable and then passing it to a field? can you post the full code you are using to retrieve first_name? Please check this example.
I tested the query on my database and it’s working just fine. Maybe it’s the issue of how you are executing it and how you are passing value?
Thread Starter
dkance
(@dkance)
Hi @aswingiri, @missveronicatv,
I finally resolved the issue with your advice.
Thanks a lot!
Regards.