Tip: Display information to affiliates only

Discussion in 'Customization & add-ons' started by xlguy, Apr 7, 2005.

  1. xlguy

    xlguy Guest

    This is obvious, but new users might not know: If you want to include some text or an image on your member.php page that only affiliates should see, then just edit members.html in the <templates> directory and add:

    PHP:
    {if $smarty.session._amember_user.is_affiliate}
    above the text and then below add

    PHP:
    {/if}
    For example it might like look this:

    PHP:
    {if $smarty.session._amember_user.is_affiliate}
    Hello affiliates keep earning more money!
    {/if}
    Hope that helps someone out there :)
  2. ezminisites

    ezminisites New Member

    Joined:
    Jul 3, 2006
    Messages:
    40
    looks great! What about adding a piece of html code if the member has a specific membership? My membership program has different levels of membership and I would like to display different html to each member based on the level of membership they have. Any ideas?
  3. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    {if in_array(1, $_SESSION[_amember_product_ids])}
    code for product #1
    {elseif in_array(2, $_SESSION[_amember_product_ids])}
    code for product #2
    {elseif in_array(3, $_SESSION[_amember_product_ids])}
    code for product #3
    {/if}
  4. ezminisites

    ezminisites New Member

    Joined:
    Jul 3, 2006
    Messages:
    40
    Thanks Alex, I'll check it out!
  5. ezminisites

    ezminisites New Member

    Joined:
    Jul 3, 2006
    Messages:
    40
    OK, I tried it but got an error. Here is my code:

    PHP:
    {if in_array(10$_SESSION[_amember_product_ids])} 
    <
    img src="/img/members/bronze.jpg" width="250" height="190" hspace="0" vspace="0" />

    {elseif 
    in_array(20$_SESSION[_amember_product_ids])} 
    <
    img src="/img/members/bronze.jpg" width="250" height="190" hspace="0" vspace="0" />

    {elseif 
    in_array(6$_SESSION[_amember_product_ids])}
    <
    img src="/img/members/gold.jpg" width="250" height="190" hspace="0" vspace="0" />

    {elseif 
    in_array(9$_SESSION[_amember_product_ids])}
    <
    img src="/img/members/gold.jpg" width="250" height="190" hspace="0" vspace="0" />

    {elseif 
    in_array(18$_SESSION[_amember_product_ids])}
    <
    img src="/img/members/gold.jpg" width="250" height="190" hspace="0" vspace="0" />

    {elseif 
    in_array(17$_SESSION[_amember_product_ids])}
    <
    img src="/img/members/gold.jpg" width="250" height="190" hspace="0" vspace="0" />

    {elseif 
    in_array(15$_SESSION[_amember_product_ids])}
    <
    img src="/img/members/gold.jpg" width="250" height="190" hspace="0" vspace="0" />

    {elseif 
    in_array(11$_SESSION[_amember_product_ids])}
    <
    img src="/img/members/gold.jpg" width="250" height="190" hspace="0" vspace="0" />

    {elseif 
    in_array(19$_SESSION[_amember_product_ids])}
    <
    img src="/img/members/gold.jpg" width="250" height="190" hspace="0" vspace="0" />

    {elseif 
    in_array(4$_SESSION[_amember_product_ids])}
    <
    img src="/img/members/gold.jpg" width="250" height="190" hspace="0" vspace="0" />

    {elseif 
    in_array(12$_SESSION[_amember_product_ids])}
    <
    img src="/img/members/gold.jpg" width="250" height="190" hspace="0" vspace="0" />

    {elseif 
    in_array(8$_SESSION[_amember_product_ids])}
    <
    img src="/img/members/gold.jpg" width="250" height="190" hspace="0" vspace="0" />

    {elseif 
    in_array(3$_SESSION[_amember_product_ids])}
    <
    img src="/img/members/platinum.jpg" width="250" height="190" hspace="0" vspace="0" />

    {elseif 
    in_array(13$_SESSION[_amember_product_ids])}
    <
    img src="/img/members/platinum.jpg" width="250" height="190" hspace="0" vspace="0" />

    {elseif 
    in_array(14$_SESSION[_amember_product_ids])}
    <
    img src="/img/members/platinum.jpg" width="250" height="190" hspace="0" vspace="0" />

    {/if}
    And here is the error it gave back:

    I used the code to state the product ID for each product I have in Amember, as I use many products for tracking purposes. It looked right to me, what am I missing?
  6. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Hi,
    Where you have this code(what template)?
    Try to use: $_SESSION[_amember_product_ids] $smarty.session._amember_product_ids
  7. ezminisites

    ezminisites New Member

    Joined:
    Jul 3, 2006
    Messages:
    40
    Trying to add this to member.html so that a specific image s hows up based on the subscription the person has currently active.

    I am also wondering how to choose which image will be shown if the person has 2 subscriptions active (free AND paid for example).

    Any ideas?
  8. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Second should work then $smarty.session._amember_product_ids
  9. dan_kelly

    dan_kelly New Member

    Joined:
    Aug 29, 2006
    Messages:
    91
    Thanks for the tip!

    Where can we get a listing of all the Smarty variables that are
    available on the various pages? It's not "obvious" unless we
    have a list of available variables. :)

    Smarty seems to be a VERY powerful tool, but if we don't know
    what variable we have to work with, that power is made useless.

    Thanks,
    Dan Kelly
    MiniSiteSecretsRevealed.com


Share This Page