{if jrUser_is_logged_in()}{/if}

  • Overview

    The jrUser_is_logged_in() function returns TRUE or FALSE to the question "Is the user currently logged in?".

    This can be used in conjunction with the {if} template block to allow skin designers to show a section of the page only to users who are logged in.
  • User is logged in

    To show a section of code to a user who IS logged in, wrap it in this code:
    {if jrUser_is_logged_in()} 
        // Put here the code to be run if the user is logged in
    
    {/if}
  • User is NOT logged in

    To show a section of code to a user who is NOT logged in you can use the exclamation point (!) which means the opposite.

    This is the code to only show a section of code to a user who "is not logged in":
    {if !jrUser_is_logged_in()} 
        // Put here the code to be run if the user is NOT logged in
    
    {/if}
  • If / else

    If you want to show one thing to a user who IS logged in and another thing to a user who is NOT logged in, you could create 2 separate statements OR you could use the {else} extension to the structure.
    {if jrUser_is_logged_in()} 
        // Put here the code to be run if the user is logged in
    
    {else}
        // Put here the code to be run if the user is NOT logged in
    
    {/if}

Tags