Welcome message with username (11 posts)

  1. jhuskey
    Posted 9 years ago #

    I'm needing a plug-in that puts a welcome message on the sidebar that welcomes registered users by name and guests. Does anyone have any idea where I might find it. I've spent hours searching the web so any help would be appreciated.

  2. inktrebuchet
    Posted 9 years ago #

  3. jhuskey
    Posted 9 years ago #

    um, thanks for the reply but it appears blank to me?

  4. croila
    Posted 9 years ago #

    On the top right-hand side of the control panel when you're logged in, you'll see the message "Hello [name of logged in person]", so maybe that's what you want on the sidebar?

    If you're at all familiar with PHP, you could open up your admin-header.php file and copy some code from there.

    I think this is the code you want in your sidebar:

    <?php printf(__('Hello, <strong>%s</strong>.'), $user_identity) ?>

    However, I'm a million miles away from being a PHP expert, so that's just my guess!

  5. carnold
    Posted 9 years ago #

    OK, i got this on my site but i want to have the text say sign in/out based on whether the user is signed in or not. Now it just says Sign Out and My Profile. Can anyone help me with this? site is http://www.mytimewithgod.net

  6. pizzaman
    Posted 9 years ago #

    Here's what I use. Put it in your sidebar. Modify it to suit your needs.

    <?php if (isset($_COOKIE['wordpressuser_' . COOKIEHASH])) {
    $l = "";
    global $user_identity, $user_ID, $user_level;
    switch ($user_level) {
    case 0:
    $l = 'Subscriber';
    case 1:
    $l = 'Contributor';
    case 2:
    $l = 'Author';
    case 3:
    $l = 'Author Level 2';
    case 7:
    $l = 'Editor';
    case 10:
    $l = 'Administrator';
    } ?>
    <li><?php echo ($l); ?></li>
    <li><?php echo('Name: ' . $user_identity); ?></li>
    <li><?php echo('Articles posted: ' . get_usernumposts($user_ID)); ?></li>
    <?php } else { ?>
    <li>Not logged in/Non-member</li>
    <li>Please <a href="<?php get_settings('siteurl') ?>/wp-login.php?action=login" title="Login">Login</a> or <a href="<?php get_settings('siteurl') ?>/wp-register.php" title="Become a member so you can write articles">Register</a>.</li>
    <?php }

  7. jhuskey
    Posted 9 years ago #

    Ok, <?php printf(__('Hello, %s.'), $user_identity) ?> basically did the job I wanted. I now have a message at the top of my sidebar the reads Welcome to the site username! if their registered and if not it just reads Welcome to the site!

    Thanks for the help.

  8. jhuskey
    Posted 9 years ago #

    Well, it did work until I updated my theme. I'm using Journalized and everytime I put the code into one of the columns it only displays:


    Any ideas?

  9. KatGirl
    Posted 9 years ago #

    jhuskey, how would you change your code to say:

    if unregistered $user_identity = Guest

    display registered username

    Your help would be cool. Thanks

  10. jhuskey
    Posted 9 years ago #

    uh...good question but I'm afraid I don't know. I'm basically just copy/pasting things and expiramenting with them 'till they work. I too would like the code to say hello to guest as well. sorry I couldn't help.

  11. gspark
    Posted 9 years ago #

    <?php printf(__('Hello, %s.'), $user_identity) ?> doesn't display username

Topic Closed

This topic has been closed to new replies.

About this Topic