Am_lite not showing links with getUserLinks()

Discussion in 'aMember Pro v.4' started by crogue, Nov 10, 2012.

  1. crogue

    crogue New Member

    Joined:
    Dec 17, 2011
    Messages:
    13
    I'm trying to add some php to a wordpress widget to show a user's active links. According to http://www.amember.com/docs/API/Lite this should be pretty simple:

    PHP:
    require_once '/home/crogue/public_html/member/library/Am/Lite.php';
    $links Am_Lite::getInstance()->getUserLinks();
    Unfortunately, this didn't work. I looked at the code for the getUserLinks() function, and it's looking in the session for the links. I even went into the Lite.php code and added a test line:

    PHP:
        public function getUserLinks()
        {
            
    $sess $this->getSession();
    print_r($sess); // I added this
            
    return $sess['amember']['amember_links'];
        }
    to look at the session. (output is below) As it turns out, there is no [amember_links] stored in [amember], so that's why it wasn't finding them.
    How to I make sure that amember stores the links in the session?
    thanks!

    Code:
    Array
    (
        [__ZF] => Array
            (
                [amember_admin_auth] => Array
                    (
                        [ENT] => 1352575120
                    )
    
                [amember_admin_csrf] => Array
                    (
                        [ENT] => 1352574464
                    )
    
                [amember_auth] => Array
                    (
                        [ENT] => 1352578724
                    )
    
            )
    
        [amember_admin_auth] => Array
            (
                [admin] => 
            )
    
        [amember] => Array
            (
                [admin_redirect] => /member/admin/
            )
    
        [amember_admin_csrf] => Array
            (
                [keys] => Array
                    (
                        [0] => JLCSU30C
                        [1] => yaFlbGbY
                        [2] => a9I1n4jo
                    )
    
            )
    
        [amember_auth] => Array
            (
                [user] => Array
                    (
                        [am3:id] => 46
                        [need_session_refresh] => 
                        [signup_email_sent] => 1
                        [user_id] => 23
                        [login] => ajim
                        [pass] => $P$72tyuHGWTXZfrMGdHoQHPXb6Z/
                        [email] => ajim@
                        [name_f] => Epik
                        [name_l] => Johnson
                        [street] => 
                        [city] => 
                        [state] => 
                        [zip] => 
                        [country] => 
                        [phone] => 
                        [added] => 2010-11-16 19:08:31
                        [remote_addr] => 12.237.110.114
                        [status] => 1
                        [unsubscribed] => 0
                        [lang] => 
                        [i_agree] => 0
                        [is_approved] => 1
                        [is_locked] => 0
                        [reseller_id] => 
                        [comment] => 
                        [aff_id] => 
                        [is_affiliate] => 0
                        [aff_payout_type] => 
                        [street2] => 
                        [tax_id] => 
                    )
    
            )
    
    )

  2. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Do you have wordpress plugin configured ion aMember CP?
    That session variable (amember_links) should be set from wordpress plugin after user's login.
  3. rmara

    rmara Eager Beaver and Avid Learner

    Joined:
    Jan 21, 2013
    Messages:
    24
    Having the same issue with a php page created to show the users resources as it does on the members index page. Nothing is returned for links or subscriptions.

    PHP:
    $userlinks Am_Lite::getInstance()->getUserLinks();
    $usersubs Am_Lite::getInstance()->haveSubscriptions("ANY");
  4. thehpmc

    thehpmc Member

    Joined:
    Aug 24, 2006
    Messages:
    901
    rmara you need the following in your php page before using above calls
    PHP:
    require_once '/home/myusername/public_html/amember/library/Am/Lite.php';

Share This Page