Protecting portion of PHP page?

Discussion in 'Setting-up protection' started by amcdermott, Apr 17, 2012.

  1. amcdermott

    amcdermott aMember Pro Customer

    Joined:
    Feb 9, 2011
    Messages:
    26
    I have a PHP page in which I want to display a protected block to logged in users with Product 1 and Product 2. I want to show "Please join to view" to anyone else.

    How do I code this in PHP?

    I am using Amember v3 latest.
  2. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,274
    You can use session variables.
    if($_SESSION[_amember_user]){
    // User is logged in
    }else{
    // User is not logged in.
    }
    if($_SESSION[_amember_user][data][status][1] || $_SESSION[_amember_user][data][status][2]){
    // User have product 1 or product 2
    }

Share This Page