Link Switching Code

Discussion in 'Customization & add-ons' started by chrisellis34, Oct 13, 2005.

  1. chrisellis34

    chrisellis34 New Member

    Joined:
    Oct 13, 2005
    Messages:
    2
    I am trying to add a code that will perform this:

    I have various products listed on my page and next to each I have a order link.

    If the user is logged in and has a valid subscription to the product how can I make the order link change into an access link.

    Basically, I want the order link to send them to the signup page and the access link send them to the protected area.

    Any code for this?
  2. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
  3. chrisellis34

    chrisellis34 New Member

    Joined:
    Oct 13, 2005
    Messages:
    2
    Kind of, I figured it out

    <?php
    session_start();
    if ($au = $_SESSION['_amember_user'] . $_SESSION['_product_id = array(5)']){
    print ""<a href='http://www.yoursite.com/access.php'>Access</a>";
    } else {
    print "<a href='http://www.yoursite.com/demo.php'>Demo</a> | ";
    print ""<a href='http://www.yoursite.com/order.php'>Order</a>";
    }
    ?>

    Basically, it is checking if the member is logged in AND if they are subscribed to a certain product. Then if they are logged in it prints an Access link. If not logged in, it will print demo and order links.

    For example:

    You list some protected areas of your site on a page:

    Beginner Lessons
    Intermediate Lessons
    Advanced Lessons

    It will print Access or Demo and Order links (this can be changed of course to whatever you want) next to the product based on if they are logged in or out and a subscriber.

    You can do this to everything!

    Have fun!

Share This Page