Code to check user is logged in

Discussion in 'Customization & add-ons' started by evevera, Apr 30, 2011.

  1. evevera

    evevera Member

    Joined:
    Jul 28, 2010
    Messages:
    41
    I want to check in layout.html template whether a user is logged in so I can hide/unhide certain parts of the layout (header and sidebars).

    What code would I use for this?
  2. davidm1

    davidm1 aMember User & Partner

    Joined:
    May 16, 2006
    Messages:
    4,437
    {if $smarty.session._amember_login}

    {/if}

    David
  3. evevera

    evevera Member

    Joined:
    Jul 28, 2010
    Messages:
    41
    Is there a way to check whether they're viewing a certain page of not from the layout template? Like if I wanted different things to show on the thanks.php page?
  4. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    This way better to modify exact template.
    For example thanks.html:
    {if $smarty.session._amember_user}
    {include file="header1.html"}
    {else}
    {include file="header2.html"}
    {/if}

Share This Page