v3 session variables vs API/Light?

Discussion in 'aMember Pro v.4' started by regis, Mar 27, 2012.

  1. regis

    regis aMember Pro Customer

    Joined:
    Aug 29, 2006
    Messages:
    40
    Hi,

    I currently have v3 setup and running and have used session variables extensivly through out our menu system and smarty templates. I would like to keep the existing code if possible, but I know that v4 has changed a lot and it's recomended for any kind of user interface logic to use the API/Light which provides a lot of very useful classes and methods.

    Just wondering if anyone has had experiece of this sort and how involved was it to switch to using v4 and API/Light as opposed to session variables?

    Any strategies to make the process of upgrading to v4 a little less painful?

    Thanks much!

    Sean.
  2. xindexer

    xindexer Member

    Joined:
    Apr 17, 2011
    Messages:
    52
    I'm about 5 days in front of you, I finally made the switch starting on Friday. I can say that V4 is a significant step up in quality. Everything is better; however, since it has been completely rewritten - you will have to rewrite everything that interacts with V3. There are no $_SESSION variables, everything is done with Am_Lite. Am_Lite is useful, but it does have some limitations (see my question below on how to refresh the data).

    I will be honest with you, there is a pretty steep learning curve with V4. But once you understand how they built it, you can see how much better it really is. You will also have to rewrite all of your plugins. The plugin architecture is completely different and again, it will take some time to make it work.

    I'm very happy with my decision to upgrade - but it has taken a fair amount of time as I had a lot of customization in my V3 build.
    regis likes this.
  3. regis

    regis aMember Pro Customer

    Joined:
    Aug 29, 2006
    Messages:
    40
    Thanks for the reply xindexer! This will help mentally prepare me for what lays ahead :) Our site is not terribly big but we have a lot of different plans setup in a very particular way so that's going to be the biggest part is re-instating all the plan links to work the same way.

    One thing of interest to me was the new use of categories with the plans... where as v3 you had Group ID's to separate the plans out. I'm guessing now I could do it in a marathon weekend though.

    Thanks again,

    Sean.
  4. regis

    regis aMember Pro Customer

    Joined:
    Aug 29, 2006
    Messages:
    40
    xindexer - I just did the upgrade this weekend, and I'm having the worst time trying to get customer info out of the API...

    I'm determined that I have to use the full API because the Light doesn't seen to include more detailed member info like "company Name", "phone", "address", etc..

    Do you have any pointers or suggestions for getting that info??

    Thank you,

    Sean.
  5. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Sean,
    You can get all info from user's profile.
    Form example:
    PHP:
    <?php
    include "amember/library/Am/Lite.php";
    print_r(Am_Lite::getInstance()->getUser());
    ?>
    will output:
    Array ( [created-by-plugin] => wordpress [need_session_refresh] => [signup_email_sent] => 1 [user_id] => 7 [login] => alexander [pass] => xxxxxxxxxxxx => alexander@central-office.net [name_f] => Alex [name_l] => Ivanoff [street] => [city] => [state] => [zip] => [country] => [phone] => [added] => 2012-06-01 14:51:19 [remote_addr] => 192.168.1.1 [status] => 1 [unsubscribed] => [lang] => [i_agree] => 0 [is_approved] => 1 [is_locked] => 0 [reseller_id] => [comment] => [aff_id] => [is_affiliate] => 0 [aff_payout_type] => [tax_id] => [test] => )
  6. regis

    regis aMember Pro Customer

    Joined:
    Aug 29, 2006
    Messages:
    40
    Alex to the rescue! :)

    Thank you Alex!

Share This Page