Logged in - Getting a global variable for wordpress

Discussion in 'Integration' started by awc045, Jul 17, 2014.

  1. awc045

    awc045 aMember Pro Customer

    Joined:
    Apr 21, 2009
    Messages:
    3
    Evening,

    I'm trying to get something that I can key off for showing and hiding wordpress menu's depending on if the user is logged into amember or not.

    I've tried a couple solution but can't seem to get something that works across the board.

    if (!Am_Lite::getInstance()->isLoggedIn()) {
    // user is not logged in.
    $amember_session = false;
    }else{
    // user is logged in.
    $amember_session = true;
    }

    I also saw some stuff about bootstrap.php but that started throwing errors 'Script Error
    An internal error happened in the script, please contact webmaster for details'

    Any insight on what function I can use to show/hide things would be great. Thanks in advance
  2. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    If you are using amember4 plugin in wordpress try to use this code:
    PHP:
    if(am4PluginsManager::getAPI()->isLoggedIn())
      print 
    "Logged in!";
    else
      print 
    "not logged in!";
  3. awc045

    awc045 aMember Pro Customer

    Joined:
    Apr 21, 2009
    Messages:
    3
    Worked for me, thanks for the quick reply.

Share This Page