User Info

Discussion in 'aMember Pro v.4' started by sukhbirgill5, Mar 30, 2013.

  1. sukhbirgill5

    sukhbirgill5 New Member

    Joined:
    Mar 30, 2013
    Messages:
    6
    Hi, I already have amember but i have one question!! I need to make user info page for a client that can be viewed by putting in their username. I have found a example on the internet but i don't know the code maybe u guys can help. the example is http://sastatv.com/secure/php/getUserInfo.php?id=sastatrial the user info can be viewed by putting the username after id=. please help fast! Thanks!
  2. sukhbirgill5

    sukhbirgill5 New Member

    Joined:
    Mar 30, 2013
    Messages:
    6
  3. gswaim

    gswaim CGI-Central Partner

    Joined:
    Jul 2, 2003
    Messages:
    641
    I am not sure what you are asking...

    The link you gave as an example shows a login panel. This is what you get with you try to access a file that is inside a folder with protection. You add protection to a folder in the Protect Content section.

    You say you want to make a page that lists user info. What type of page? Are you using aMember with a CMS front-end or as a stand alone program? With WordPress you can add user info by adding placeholders to a page/post.
  4. sukhbirgill5

    sukhbirgill5 New Member

    Joined:
    Mar 30, 2013
    Messages:
    6
    Hi i am not using wordpress, but what i am trying to do is make a page that will display a custom title, the username, the day their membership started and the day their membership ends. I am trying to do this with Api/Lite but i don't know which lite codes i should use!
  5. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    You can't use Lite API in this situation. But this is possible using Am_Di.
    Here is example:
    PHP:
    include "/full/path/to/amember/bootstrap.php";
    $di  Am_Di::getInstance();
    $user $di->userTable->findFirstByLogin($_GET['username']);
    // Then you can use User object in order to get info about user's subscriptions and expiration dates. 
    // Check /amember/application/default/models/User.php for available functions. 


  6. sukhbirgill5

    sukhbirgill5 New Member

    Joined:
    Mar 30, 2013
    Messages:
    6
    if u dont mind can u please give me an example of a function for start date and expiry?
  7. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    sure
    PHP:
    foreach($user->getActiveProductsExpiration() as $pid=>$expire){
        print 
    "Subscription begin date= ".$user->getBegin($pid)." expire_date=".$expire;
    }
  8. sukhbirgill5

    sukhbirgill5 New Member

    Joined:
    Mar 30, 2013
    Messages:
    6
    ok i tried it but it gave me a Fatal error: Call to a member function getActiveProductsExpiration() on a non-object in /home/MYUSERNAME WAS HERE/public_html/users.php on line 5hp]My code was like this
    PHP:
    [/COLOR][/FONT][/SIZE]
    <?php
    include "/home/My Username/public_html/buy/bootstrap.php";
    $di  Am_Di::getInstance();
    $user $di->userTable->findFirstByLogin($_GET['username']);
    foreach(
    $user->getActiveProductsExpiration() as $pid=>$expire){
        print 
    "Subscription begin date= ".$user->getBegin($pid)." expire_date=".$expire;
    }
  9. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    You should replace $_GET['username'] in the code to actual username, or you should pass username via GET parameter to your script:
    /yourscript.php?username=USERNAME
  10. sukhbirgill5

    sukhbirgill5 New Member

    Joined:
    Mar 30, 2013
    Messages:
    6
    i tried this code
    PHP:
    <?php
    include "/home/My Username/signup/bootstrap.php";
    $di  Am_Di::getInstance();
    $user $di->userTable->findFirstByLogin($_GET['/userinfo.php?username=USERNAME']);
    foreach(
    $user->getActiveProductsExpiration() as $pid=>$expire){
        print 
    "Subscription begin date= ".$user->getBegin($pid)." expire_date=".$expire;
    }
    But it returned this error: Fatal error: Call to a member function getActiveProductsExpiration() on a non-object in /home/username/pathtouserinfo/userinfo.php on line 5

Share This Page