• Let’s say I have a WordPress 2.5-powered website on a hosting provider other than WordPress.com.

    Now let’s say my website wants visitors to Register to be able to do things like leave comments and such.

    Let’s say that there is a Register/Login thing at the top of the website so visitors can register easily, or if they are registered users, login easily.

    Now let’s say that I, as the creator of the website, would think it were cool if, for logged-in registered users, the Login/Logout thing would say something like, “Hello, User Name” next to the Logout.

    So my inquiry is, with conditions as they are, is there any way to display a User Name the same way you might display an Author name? Is there something like <?php the_author_nickname(); ?> but for Users?

    Certainly not a necessary tag, but something nice for a registered User to see on a website, of course.

    Just wondering. Thanks! ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • Have you tried the $user_identity variable?

    This bit of code is copied from /wp-adimn/admin-header.php:
    <?php printf(__('Howdy, <a href="%1$s">%2$s</a>!'), 'profile.php', $user_identity) ?>

    Thread Starter Jason R. Johnston

    (@evermail)

    No, that doesn’t seem to work.

    Thread Starter Jason R. Johnston

    (@evermail)

    This was posted by culvejc 2 weeks ago which answers my problem. Thanks all!

    I found your post on Google, and figured out a painfully simple solution on my own.

    <!-- User Start -->
    
    <?php if ( $user_ID ) :
    
    // here's the kicker
    global $user_identity;
    // really. that's it. ?>
    
    Welcome <b><?php echo $user_identity; ?></b>!
    ( <a href="/wp-login.php?action=logout">Log Out</a> | <a href="/wp-admin/profile.php">Profile</a><?php wp_register(); ?> )
    
    <?php else : ?>
    
    Welcome <b>Guest</b>!
    ( <a href="/wp-login.php">Log In</><?php wp_register(); ?> )
    
    <?php endif; ?>
    
    <!-- User End --></a>

    Easy enough, right? Cheers.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘User greetings possible?’ is closed to new replies.