The session object is one of the global objects and is available to all theme template pages, but not available to email templates. Access to the currently signed in user and associated account is gained via the session object, via session.user and session.user.account respectively.

Variables

.id

Unique ID for the current session.

TYPE
numeric
CONSTRAINTS
>= 1
PRESENCE
always

Examples

CODE{{ session.id }}
OUTPUT112345

.user

Currently signed in user. If the site visitor has not signed in, this will be set to null.

TYPE
user object
CONSTRAINTS
n/a
PRESENCE
always, null if not signed in

Variable Dump

Copy and paste the below HTML into any template page, to see all session data dumped to your page. You can then simply remove the unnecessary fields and other elements, and format the remaining fields however necessary to achieve the desired look and feel.

<style> .thedump .name{ background-color:#3A5FCD; color:white; padding:0.5em; font-weight:bold; } .thedump .code{ background-color:#888888; color:white; padding:0.5em; } .thedump .out{ background-color:white; color:#555555; padding:0.5em; border-bottom:1px solid #CCCCCC; margin-bottom:1em; } .thedump .code pre{ padding:0; margin:0; font-size:1.1em; } </style> <div class="thedump"> <div class="name">Session ID</div> <div class="code"><pre>&#123;&#123; session.id &#125;&#125;</pre></div> <div class="out">{{ session.id }}</div> <div class="name">Products</div> <div class="code"><pre>&#123;&#37; if session.user &#37;&#125; &lt;p&gt;user logged inlt;/p&gt; &#123;&#37; else &#37;&#125; &lt;p&gt;user NOT logged in&lt;/p&gt; &#123;&#37; endif &#37;&#125;</pre></div> <div class="out"> {% if session.user %} <p>user logged in</p> {% else %} <p>user NOT logged in</p> {% endif %} </div> </div>