Fork me on GitHub

Dynamic user data and standard user data  Bottom

  • Im finding it to be really annoying when trying to call Dynamic user data versus standard user data. Using something like pnUserGetVar('uname') works just fine to get their user name, but if I wanted to get their lastname, which is a dynamic field i have setup, pnUserGetVar('lastname'). I would be completely out of luck. How am I supposed to reference this data? My site revolves around the users dynamic data inputs, such as lastname, first name, city, etc, etc. Any help would be appreciated.
  • Just a note. I know how to call them in templates, but not in the actual PHP code. I know it should be similiar, but im not getting it for some reason.
  • Have you setup your module to function like in the pnMDG for using dynamic user vars?

    http://docs.postnuke.com/index.php?module=Static_Docs&func=view&f=pnmdg/ch02s02.html
  • that API is 3 years old and not up to date.
  • ok, i guess I got it to work, not sure why it didnt before. Here is an example.

    $LASTNAME = pnUserGetVar('_LASTNAME');
    echo $LASTNAME;
  • Core fields are aliased...

    Dynamics are not and so are referenced by their proplabel information

    core aliases :

    Code

    $uid = pnUserGetVar('uid');

    $uname           = pnUserGetVar('uname');
    $name            = pnUserGetVar('name');
    $email           = pnUserGetVar('email');
    $femail          = pnUserGetVar('femail');
    $url             = pnUserGetVar('url');
    $timezone_offset = pnUserGetVar('timezone_offset');
    $user_avatar     = pnUserGetVar('user_avatar');
    $user_icq        = pnUserGetVar('user_icq');
    $user_aim        = pnUserGetVar('user_aim');
    $user_yim        = pnUserGetVar('user_yim');
    $user_msnm       = pnUserGetVar('user_msnm');
    $user_from       = pnUserGetVar('user_from');
    $user_occ        = pnUserGetVar('user_occ');
    $user_intrest    = pnUserGetVar('user_intrest');
    $user_sig        = pnUserGetVar('user_sig');
    $bio             = pnUserGetVar('bio');


    //OR
    $userinfo = pnUserGetVars($uid);

    $uname           = userinfo['uname'];
    $name            = userinfo['uname'];
    $email           = userinfo['uname'];
    $femail          = userinfo['uname'];
    $url             = userinfo['uname'];
    $timezone_offset = userinfo['timezone_offset'];
    $user_avatar     = userinfo['user_'];
    $user_icq        = userinfo['user_'];
    $user_aim        = userinfo['user_'];
    $user_yim        = userinfo['user_'];
    $user_msnm       = userinfo['user_'];
    $user_from       = userinfo['user_'];
    $user_occ        = userinfo['user_'];
    $user_intrest    = userinfo['user_'];
    $user_sig        = userinfo['user_'];
    $bio             = userinfo['bio'];


    I may forget one or two...

    And as you found out, dynamics are by their label

    Code

    $_TEST = pnUserGetVar('_TEST');
    //or
    $_TEST = $userinfo['_TEST'];
  • thanks for the tips, that definately helps.
  • 0 users

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