<p>The Twig variable <a href="http://buildwithcraft.com/docs/templating/global-variables#currentUser" rel="nofollow"><code>currentUser</code></a> contains information about the currently logged in user, and will be <em>null</em> if no user is currently logged in.</p>

<pre><code>{% if not currentUser %}

    &lt;!-- Your login form --&gt;

{% endif %}
</code></pre>

CC BY-SA 3.0
2014-10-07T17:20:43.583Z
2014-10-07T17:20:43.583Z
Lindsey D
<p>What conditional statement would hide a form if a user is logged in?</p>

<form><conditional>
How do I hide a login form if user is logged in?
# How do I hide a login form if user is logged in?

(Asked by: username_0 on 2014-10-07)

What conditional statement would hide a form if a user is logged in?

**Tags:** form, conditional


---

## 1 answers

### Answer by username_1 on 2014-10-07. Score: 4 | Accepted answer

The Twig variable currentUser contains information about the currently logged in user, and will be null if no user is currently logged in.
{% if not currentUser %}

    

{% endif %}


---

