Sign in/My Account

Discussion in 'Templates customization' started by umitbatu, Mar 27, 2012.

  1. umitbatu

    umitbatu aMember Pro Customer

    Joined:
    Dec 16, 2011
    Messages:
    16
    What code do I put into a php page to get the same effect as on the amember.com website, in the upper right corner. When a user isn't logged in it says: 'Already a member? Sign in' If the user is signed in, user sees 'My Account | Sign Out'.​

    This issue was not solved in the thread link below​

    Attached Files:

  2. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    I thought example was already in that thread?
    PHP:
    include "amember/library/Am/Lite.php"

    $lite Am_Lite::getInstance();

    if(
    $lite->isLoggedIn()){
       print 
    "My Account | Sign Out";
    }else{
       print 
    "Already a member? Sign in";
    }
  3. umitbatu

    umitbatu aMember Pro Customer

    Joined:
    Dec 16, 2011
    Messages:
    16
    Thanks, this is not the same code as in the previous thread
  4. cristi6789

    cristi6789 New Member

    Joined:
    May 18, 2012
    Messages:
    3
    How do include this code in my page? i tried to add this in the body of the page, but it doesn't work. Am i doing something wrong
    PHP:
    <?php
    include "amember/library/Am/Lite.php"
     
    $lite Am_Lite::getInstance();
     
    if(
    $lite->isLoggedIn()){
      print 
    "My Account | Sign Out";
    }else{
      print 
    "Already a member? Sign in";
    }
    ?>
  5. davidm1

    davidm1 aMember User & Partner

    Joined:
    May 16, 2006
    Messages:
    4,437
    Did you save the file as name.php?

    David
  6. cristi6789

    cristi6789 New Member

    Joined:
    May 18, 2012
    Messages:
    3
    Yes i did, but it gives the following error when i tried to access it
    Parse error: syntax error, unexpected T_VARIABLE in /public_html/1.php on line 4
  7. cristi6789

    cristi6789 New Member

    Joined:
    May 18, 2012
    Messages:
    3
    ok i made it work finally.
    so this the code, for those whom it my help with the same problem
    this code works, i tested it.
    don't forget to put it in a PHP file


    PHP:
    <?php
      
    include "amember/library/Am/Lite.php";
     
    $lite Am_Lite::getInstance();
     
    if(
    $lite->isLoggedIn()){
      Echo 
    '<a href="amember/member">My Account</a>'; Echo ' | '; Echo '<a href="amember/logout">Sign Out</a>';
    }else{
      Echo 
    'Already a member? <a href="amember/login">Sign In</a>';
    }
    ?>

Share This Page