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.