<p>You need to select the value</p>

<pre><code>{% set user = craft.users
    .id(currentUser.id)
    .addSelect(['users.unverifiedEmail'])
    .one()
%}
{{ user.unverifiedEmail }}
</code></pre>

CC BY-SA 4.0
2018-07-20T08:41:09.760Z
2018-07-20T08:41:09.760Z
Robin Schambach
<p>The <code>currentUser.unverifiedEmail</code> variable, which is public, is always empty on front end even after email change.</p>

<p>I thought it was a bug. I contacted Craft support about this, and here is Brad's answer:</p>

<blockquote>
  <p>That's expected behavior... the default UserQuery (which is what {{
  currentUser }} is) only grabs a small subset of columns in it's select
  to avoid exposing potentially sensitive user account information
  throughout the system.
  <a href="https://github.com/craftcms/cms/blob/develop/src/elements/db/UserQuery.php#L310-L325" rel="nofollow noreferrer">https://github.com/craftcms/cms/blob/develop/src/elements/db/UserQuery.php#L310-L325</a></p>
  
  <p>If you want anything outside of that, you'll have to query for the
  data directly.</p>
</blockquote>

<p>I tried this custom query:
<code>{{ craft.users.id(currentUser.id).one().unverifiedEmail }}</code>.
But even after requesting an email change, the value remain empty.</p>

<p>Any idea how to make this query from Twig?</p>

<craft3><users><query><elementquery>
How to get the unverifiedEmail value of a user after a change email request?
# How to get the unverifiedEmail value of a user after a change email request?

(Asked by: username_0 on 2018-07-20)

The `currentUser.unverifiedEmail` variable, which is public, is always empty on front end even after email change.

I thought it was a bug. I contacted Craft support about this, and here is Brad's answer:

> That's expected behavior... the default UserQuery (which is what {{
> currentUser }} is) only grabs a small subset of columns in it's select
> to avoid exposing potentially sensitive user account information
> throughout the system.
> <https://github.com/craftcms/cms/blob/develop/src/elements/db/UserQuery.php#L310-L325>
>
> If you want anything outside of that, you'll have to query for the
> data directly.

I tried this custom query:
`{{ craft.users.id(currentUser.id).one().unverifiedEmail }}`.
But even after requesting an email change, the value remain empty.

Any idea how to make this query from Twig?

**Tags:** craft3, users, query, elementquery

---

## 1 answers

### Answer by username_1 on 2018-07-20. Score: 2 | Accepted answer

You need to select the value
{% set user = craft.users
    .id(currentUser.id)
    .addSelect(['users.unverifiedEmail'])
    .one()
%}
{{ user.unverifiedEmail }}


---

