• I want to display the usernames of logged-in users, and found the below code to do so. However, if someone is not-logged in, I’d like to display a “Welcome Guest, Log-In or Sign Up” message.

    I am no good with php, can somebody help?

    <?php if (is_user_logged_in()){ global $current_user; ?>
    Hello, <strong><?php echo $current_user->first_name; ?></strong>!
    <?php } endif; ?>

    Thank you!

Viewing 1 replies (of 1 total)
  • hi. i discovered this code. you might want to try it if you are still looking for the answer.

    <?php if (is_user_logged_in()){
    global $current_user;
    get_currentuserinfo();
    echo (‘Welcome back, ‘ . $current_user->display_name . “\n”);
    }
    else {
    echo “Welcome, Guest”;
    };
    ?>!

Viewing 1 replies (of 1 total)
  • The topic ‘Show Logged-In Usernames’ is closed to new replies.