Display content to members who have no subsciption

Discussion in 'Setting-up protection' started by chai714, Dec 9, 2016.

Thread Status:
Not open for further replies.
  1. chai714

    chai714 New Member

    Joined:
    Apr 28, 2014
    Messages:
    18
    Hi,

    I would like to display certain divs to members who don't have an active subscription but are logged in. I am using the following code to display certain divs but to members who have no subscription, they see nothing. Thus, I have created my own "bug". How can I get this content to display to someone whose logged in but has no active subscription?

    Code:
    <div class="header-nav-main header-nav-main-effect-1 header-nav-main-sub-effect-1 collapse">
                                               
                                               
                                                <!-- MENU for Guests-->
                                                <?php if(!Am_Lite::getInstance()->isLoggedIn()): ?>
                                                    <?php
                                                    $stack = Stack::getByName('nav');
                                                    $stack->display();
                                                    ?>                        
                                                <?php endif; ?>
                                               
                                                <!-- MENU for MEMBERS -->
                                                <?php if(Am_Lite::getInstance()->haveSubscriptions(array(1,2,3))) : ?>
                                                    <?php
                                                    $stack = Stack::getByName('nav-members');
                                                    $stack->display();
                                                    ?>
                                                 <?php endif; ?>   
    </div>
  2. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295
    Your approach is quite good. The last part will be:
    PHP:
    <?php if(Am_Lite::getInstance()->isLoggedIn() && !Am_Lite::getInstance()->haveSubscriptions(Am_Lite::ANY)): ?>
        <?php
        $stack 
    Stack::getByName('nav-member-notactive');
        
    $stack->display();
        
    ?>
    <?php 
    endif; ?>
    References:
    http://www.amember.com/docs/API/Lite
    chai714 likes this.
  3. chai714

    chai714 New Member

    Joined:
    Apr 28, 2014
    Messages:
    18
    Thank you very much Caesar. Worked perfectly. :):):)
    caesar likes this.
  4. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295
    I am glad to hear that. You are welcome!
Thread Status:
Not open for further replies.

Share This Page