Show product specific information on the profile page

Discussion in 'Templates customization' started by mediahackers, Sep 18, 2007.

  1. mediahackers

    mediahackers New Member

    Joined:
    Jul 3, 2007
    Messages:
    10
    Hi there

    Suppose I want ot show product-specific fields on the member's profile page - what is the correct syntax to show these specific fields:

    {if in_array ("1", (array)$_SESSION['_amember_product_ids'])}

    -- Then show this field

    {/if}

    Is returning an unbalanced Smarty Syntax error -

    Am I using the correct variable on profile.html to return the correct product id?

    Thanks so much

    mediahackers
  2. mediahackers

    mediahackers New Member

    Joined:
    Jul 3, 2007
    Messages:
    10
    Here's the solution . . .

    Answer my own question!

    {if in_array(1, (array)$smarty.session._amember_product_ids)}

    . . . . fields to be specific about . . .

    {/if}

    As per this post

    HTH

    mediahackers
  3. mediahackers

    mediahackers New Member

    Joined:
    Jul 3, 2007
    Messages:
    10
    Doesn't work if member has not completed payment

    This code will not work if member has not completed payment - does someone know if an else statement that can be placed in here that will pull back the correct data? product_id is in there because I can see it under edit user payment info on the debug info in admin - anyone? - Alex?

    Many thanks
  4. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    aMember set only info about completed subscriptions in session.
    For not completed you have to code query to amember_payments table in database:
    {php}
    $payments= $db->get_user_payments($_SESSION[_amember_id], 0);
    // This will return all subscriptions that user have(both completed and not completed)
    {php}
  5. miso

    miso aMember Pro Customer

    Joined:
    Aug 22, 2006
    Messages:
    543
    What's puzzling to me is how do you pull that if/else statement off for multiple product IDs in the same line without replicating the if in_array statement for each...

Share This Page