Added field session variable?

Discussion in 'Customization & add-ons' started by moonwalker, Oct 20, 2010.

  1. moonwalker

    moonwalker aMember Pro Customer

    Joined:
    Aug 21, 2010
    Messages:
    52
    Hi,

    I've just added a new field to the profile page called category.

    Now I need to check what category the client has chosen, so I can provide the right information to him. Let's take an example:
    PHP:
    When a visitor visit the following page:
    http://www.mysite.com/category.php?cat=music
    <?php
    $category 
    $_GET['cat'];

    if(
    $category == "music"){

    show here all clients with the category music.

    }

    ?>
    So the question is how to check what category my client has chosen.

    Also I need a little help with another issue. My clients can purchase plans to add images, videos or audio. But I have a page called user.php. This page shows every client I have in my database to the visitor. But I only need to show the users who paid for a plan AND are active.

    I was looking at the database and I saw the Expire Date field, so I can check if todays date is bigger than the Expire Date. But I can't find the field that shows if a user is active or not.

    So in simple code it would be something like:
    PHP:

    SELECT username FROM users WHERE users
    ='active' AND expire_date now()

    Any help is much appreciated!

    Thanks.
  2. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,274
    1. here is example:
    PHP:
    <?php  
    // user should be logged in at this point. You can include php protection code to make sure that user logged in
    session_start();
    if(
    $_SESSION[_amember_user][category]=='music'){
    // User have music category
    }
    ?>
    Above example valid if category filed was set as SQL, for common field you should use $_SESSION[_amember_user][data][category]
    2. amember_members table hace status field:
    0 - means pending user
    1 - active
    2 - expired.
    So you can use this query:
    Code:
    select login from amember_members where status=1
    
    future likes this.
  3. moonwalker

    moonwalker aMember Pro Customer

    Joined:
    Aug 21, 2010
    Messages:
    52
    Awesome! Thank you very much!

Share This Page