Displaying Current User First Name, Last Name, and ID in Custom Attributes

I’m attempting to create a text element that has a set of custom attributes displaying the first name, last name, and ID of the current logged in user.

Unfortunately, this does not appear to be working. and it’s just showing the dynamic code when I look in the inspector. The custom attributes I setup are below.

userID = {{ user.id }}
firstName = {{ user.meta({“key”:“first_name”}) }}
lastName = {{ user.meta({“key”:“last_name”}) }}

Any idea what I’m doing wrong here? I do have Twig enabled.

Hello @OctoCog,

Thanks for writing to us.

I would suggest you please add these dynamic content codes and check it

userID = {{ user.id }}
firstName = {{ user.meta({'key':'first_name'}) }}
lastName = {{ user.meta({'key':'last_name'}) }}

Hope it helps
Thanks

@prakash_s I added these dynamic codes you provided into the custom attributes and the only information that is being pulled is the User ID. Everything else is empty.

Hey @OctoCog,

It seems that you are using Twig. Is that feature enabled in your theme options?

If the issue persists, please provide us with your WP details so we can check. You can create a secure note in your next reply with the following info:
– Link to your site
– WP login URL
– WP username
– WP password
– WP Administrator Role
– Confirmation that we can access and make changes to your site

To know how to create a secure note, please check this out: How The Forum Works

image

Best Regards.

Hi @ruenel,

Yes, I have Twiig enabled. I’ve added a secure note to this post.

Hello @OctoCog,

I tried to access your site dashboard but the given login details are not working please recheck and send us again. Please share the exact page URL as well.

Thanks

@prakash_s Sorry, there was a typo on the username. I corrected it. You should be able to login now.

Hey @OctoCog,

Please make sure that the user has the first name and the last name.

And then do the test again:

Best Regards.

@ruenel Ah, my mistake I thought those items were filled out for my current account but they were not. Thank you for confirming.

Hey @OctoCog,

You’re most welcome!