Support » Plugin: Ultimate Member – User Profile, User Registration, Login & Membership Plugin » How can I use shortcodes to greet Welcome username on Theme header

  • Resolved skandibanda


    I wanted to use somehow like below in my Header.php file to greet if they are logged in and for loggedout users say Hi Guest!

    [um_loggedin] Welcome, {first_name}[/um_loggedin]
    [um_loggedout] Welcome Guest! [/um_loggedout]

    But none of this short codes seems working. Can you please suggest how to achieve this. For time being, using a very generalized code below:

    `<div class=”top-header h2″> <!– Modified, for readability –>
    <h1>Samaikya Telugu Vedika</h1>
    <h2>తెలుగు సాంస్కృతిక సంఘం, స్టుట్గార్ట్ ప్రాంతం</h2>
    /*if ( is_user_logged_in() ) {
    echo ‘Welcome, registered user!’;
    } else {
    echo ‘Welcome, visitor!’;
    echo ‘<div class=”top-header h2″>’;
    if ( is_user_logged_in() ) {

    echo ‘<h2>Welcome, registered user!</h2>’;
    //echo $_SESSION[‘username’];
    //[um_loggedin] Welcome back {first_name} [/um_loggedin]
    } else {
    echo ‘<h2>Welcome Guest!</h2>’;
    echo ‘</div>’;

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Champ Camba


    Hi @skandibanda

    You can try adding the following code to your theme/child-theme’s functions.php file or use the Code Snippet plugin to run the code:

    function um_101521_display_username(){
        $user_id = get_current_user_id();
        um_fetch_user( $user_id );
        return um_user("first_name");

    Once the code is added to your site, you can use this shortcode to display the first name: [um_display_username]


    Plugin Contributor Champ Camba


    Hey there!

    This thread has been inactive for a while so we’re going to go ahead and mark it Resolved.

    Please feel free to re-open this thread by changing the Topic Status to ‘Not Resolved’ if any other questions come up and we’d be happy to help. 🙂


Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.