Support

Account

Home Forums Front-end Issues Show Custom Fields in a User Profile on Frontend

Helping

Show Custom Fields in a User Profile on Frontend

  • Hi there,

    We are building a website for a client. This client requires certain information to be input on user accounts on their website.

    We have put together the fields for this in the User Profile, but the client would also like this to display on the front end.

    E.g.

    Customer signs up and purchases – their purchases are then manually input in to the fields on their User Profile. When this customer logs in, our client would like to be able to display this information (or these fields/table) in the My Account page.

    We are using Elementor Pro and I’ve tried pretty much everything to get this to work, but no luck.

    Any help with this is greatly appreciated as this is a good feature and we’d like to replicate this across other sites!

    Many thanks in advance.

  • HI @reason8

    You can access the data from a user using:

    
    <?php
    if ( is_user_logged_in() ) :
    
    	$user_id = get_current_user_id();
    	$value = get_field( 'my_field', "user_".$user_id );
    	if($value):
    		echo $value;
    	endif;
    
    endif;
    

    You’d just need to add that in to your template

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.