Protecting Content in Wordpress

Discussion in 'Customization & add-ons' started by appzorro, Feb 21, 2011.

  1. appzorro

    appzorro New Member

    Joined:
    Feb 18, 2011
    Messages:
    6
    How to integrate the protection of the template Wordpress using php code without the use of SHORTCODES.

    PHP:
    <?php
    session_start
    ();
    if (
    $au=$_SESSION['amember_protect']){ // user is levels

    } else { // user is not levels

    }
    ?>
    Instead, the code: [amember_protect levels='level1,level2']Test[/amember_protect]
  2. alexander1232

    alexander1232 New Member

    Joined:
    Oct 1, 2010
    Messages:
    2
    Inside wordpress templates you can use current_user global variable.
    So,
    PHP:
    if(array_intersect(array('level1''level2'), (array)$GLOBALS[current_user]->_amember_levels)){
    // User have level1 or level2
    }else{
    // Not have
    }
  3. appzorro

    appzorro New Member

    Joined:
    Feb 18, 2011
    Messages:
    6
    Thank you!

Share This Page