Fork me on GitHub

Pulling User ID from Session  Bottom

  • I know this is a pretty noob question, but i'm just looking for a simple PHP script that will give the username or userid of the person viewing the script. It will be stored in a PHP block along with aditional code, just having trouble getting the userid.

    Thanks
  • pnUserGetVar($varname)
    where $varname can be 'uid', 'uname'...
    '_UREALNAME', '_UREALEMAIL', '_YOURAVATAR', any account property
    icon_wink

    --
    - Mateo T. -
    Mis principios... son mis fines
  • That'll work, but it's depreciated (I believe). Using the object library it would be

    Code

    $user_id = SessionUtil::getVar('uid');
    Loader::loadClass('UserUtil');  
    $user_name = UserUtil::getPNUserField($user_id, 'uname'));


    --
    Under Construction!
  • Thanks guys, worked perfectly.

This list is based on users active over the last 60 minutes.