• Resolved drabiej

    (@drabiej)


    Basically I’d like to duplicate the Admin panel functionality. If someone is logged, I’d like them to see a “Hello, $user_id” where $user_id is their nickname.

    I looked through the Template Tags but don’t see anything that will do it — anyone point me the right way? ??

Viewing 7 replies - 16 through 22 (of 22 total)
  • Geez, V, I was only repeating what I heard from K . . . um . . . nevermind.

    They’re all out to get me. I maintain my innocence. I will go to the stake wearing white sackcloth and ashes, my hair…. um. No, that was some movie or the other, wasn’t it?

    Er. Well. Maybe we better just let this die a natural death, hmmm?

    I got an error using:
    get_currentuserdata();
    …but after some rummaging, tried this, and it worked:
    get_currentuserinfo();

    (I’m using wp 1.5.2 at the moment).

    This feature looks cool. So what was the code and what files do I edit??

    See Skippy’s post above for the code, and I believe you’d edit it into header.php – at least that would seem to make sense. If that doesn’t quite get it, then perhaps just before the loop in index.php, single.php, etc.

    you can get away with not using

    global $user_identity;
    get_currentuserinfo();

    if your template just has a single index.php file (meaning no header.php, sidebar.php, footer.php etc)

    For instance, the simple-green theme I didn’t have to use global, or get_currentuserinfo();

    however, with templates that DO have them split up in multiple files (I just found this out reciently after trying to split the simple-green theme up into multiple files) you HAVE to use global.

    however, get_currentuserinfo(); isn’t needed either way. not sure why that is… In fact, I used global inside of sidebar.php, just before using $user_identity, and it worked just fine. I didn’t have to put global in header.php or index.php, I’m assuming the reason is because globals are no longer registered inside multiple includes (shrugs) thats just a guess though.

    but I ‘HAD” to use global somewhere in my templates, if my templates have a header, index. sidebar, and footer, otherwise $user_ID, $user_identity, etc etc have no values, so each variable you want to use, you have to setup a global statement just before it.

    but i don’t have to use global if the template is just within an index.php (no header or sidebar in the template)

    weird eh?

Viewing 7 replies - 16 through 22 (of 22 total)
  • The topic ‘how to say ‘howdy, $user_id’’ is closed to new replies.