Having problem with Am_Lite::getInstance()->haveSubscriptions($search)

Discussion in 'Setting-up protection' started by blctech, Nov 13, 2014.

  1. blctech

    blctech aMember Pro Customer

    Joined:
    Mar 1, 2013
    Messages:
    11
    Hi

    I upgraded to am 4.4.4. I use Am_lite calls in my WP 3.9 to check if a user has a current product in a list of products in $search
    Am_Lite::getInstance()->haveSubscriptions($search)
    returns true if user have active subscription to $search
    It was working correctly before the upgrade now that call does not product correct results. It does not come back with true even though I know for a fact that a customer has a current product in the list.

    When I use:
    Am_Lite::getInstance()->hadSubscriptions($search)
    return true if user had before or has now subscription to $search
    This comes back with a true if a customer has had or only has a product subscription or both.

    Has anyone had a problem with this API call?
  2. blctech

    blctech aMember Pro Customer

    Joined:
    Mar 1, 2013
    Messages:
    11
    After pulling my hair out for 3 hours are pouring over the code for the API call, I found that the api call works if the products sent in array, the api call contain any sequence of products in order except if product 1 is in the sequence. If 1 is listed in the array, the call fails in various ways. In the product list product 5 was imported after product 1 in the import. They show up as 1,5,2,3,4,,6,7,8 ....... Is this a problem? In ver 3 we could order the products but I don't see that in ver 4
  3. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295
    We do not change anything in Am_Lite API recently. It is quite stable. Please note you need to use product ids (column # in product grid). In case you still have this issue please contact me in helpdesk (https://www.amember.com/support) I will check your code.

Share This Page