Getting userid

Discussion in 'Integration' started by skbohler, Jan 24, 2013.

  1. skbohler

    skbohler aMember Pro Customer

    Joined:
    Jun 1, 2006
    Messages:
    44
    What is the code to call in a PHP script to get the userid and username of a user?

    Thanks in advance.
  2. thehpmc

    thehpmc Member

    Joined:
    Aug 24, 2006
    Messages:
    901
    That would depend upon which version of aMember you are using, V3 or V4.

    You don't say.
  3. skbohler

    skbohler aMember Pro Customer

    Joined:
    Jun 1, 2006
    Messages:
    44
    My apologies. In using the latest version 4.x
  4. thehpmc

    thehpmc Member

    Joined:
    Aug 24, 2006
    Messages:
    901
  5. skbohler

    skbohler aMember Pro Customer

    Joined:
    Jun 1, 2006
    Messages:
    44
    I did see that. However, I don't know enough about php to implement. When I throw the include and assignment in my script, it just gives a generic error.
  6. davidm1

    davidm1 aMember User & Partner

    Joined:
    May 16, 2006
    Messages:
    4,435
    Havent found userid yet, heres username:

    require_once '/home/amember/public_html/am4beta/library/Am/Lite.php';
    $user = Am_Lite::getInstance()->getUsername();


    David
  7. davidm1

    davidm1 aMember User & Partner

    Joined:
    May 16, 2006
    Messages:
    4,435
    $userid = Am_Lite::getInstance()->getUser();
    echo $userid[user_id];


    David
  8. skbohler

    skbohler aMember Pro Customer

    Joined:
    Jun 1, 2006
    Messages:
    44
    OK, I've got it.
    Thanks!
  9. beejeebers

    beejeebers Member

    Joined:
    Sep 14, 2007
    Messages:
    58
    AHHHHHH

    I was looking for this for about 2 hours now!

    $userid = Am_Lite::getInstance()->getUser();
    echo $userid[user_id];

    Thanks!

    :)
  10. cyberrule

    cyberrule New Member

    Joined:
    Jun 14, 2014
    Messages:
    1

Share This Page