Use current language variable

Discussion in 'aMember Pro v.4' started by richard_vencu, Aug 2, 2013.

  1. richard_vencu

    richard_vencu New Member

    Joined:
    Nov 25, 2012
    Messages:
    25
    I am setting up a 2 languages system and my other PHP apps support those languages via some switches. How can I detect the language selected in aMember then to pass it along to protected apps?
  2. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295
    I guess your application is written in PHP.

    In this case you can use Am_Lite API to retrieve chosen lang option for currently logged in user.
    http://www.amember.com/docs/API/Lite

    PHP:
    <?php
    require_once '/home/myusername/public_html/amember/library/Am/Lite.php';
    if (
    m_Lite::getInstance()->isLoggedIn()) {
        
    $user Am_Lite::getInstance()->getUser();
        
    $lang $user['lang']; //$lang should be populated with  chosen language for currently logged in user
    }

Share This Page