• 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.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter jhuskey

    (@jhuskey)

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

    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!

    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 https://www.mytimewithgod.net

    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;
    get_currentuserinfo();
    switch ($user_level) {
    case 0:
    $l = 'Subscriber';
    break;
    case 1:
    $l = 'Contributor';
    break;
    case 2:
    $l = 'Author';
    break;
    case 3:
    $l = 'Author Level 2';
    break;
    case 7:
    $l = 'Editor';
    break;
    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 }

    Thread Starter jhuskey

    (@jhuskey)

    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.

    Thread Starter jhuskey

    (@jhuskey)

    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:

    Hello,

    Any ideas?

    jhuskey, how would you change your code to say:

    if unregistered $user_identity = Guest
    otherwise

    display registered username

    Your help would be cool. Thanks

    Thread Starter jhuskey

    (@jhuskey)

    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.

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

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Welcome message with username’ is closed to new replies.