# Understanding how trust level works

**URL:** https://meta.discourse.org/t/understanding-how-trust-level-works/141593
**Category:** Development
**Created:** [February 14, 2020, 10:24am UTC](https://meta.discourse.org/t/understanding-how-trust-level-works/141593 "2020-02-14T10:24:30Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Varsii](https://avatars.discourse-cdn.com/v4/letter/v/bc79bd/32.png) [@Varsii](https://meta.discourse.org/u/Varsii)
#### Post date: [February 14, 2020, 10:24am UTC](https://meta.discourse.org/t/understanding-how-trust-level-works/141593/1 "2020-02-14T10:24:30Z")

</div>

Hello,  
I use the following code in order to get user’s trust level:

```plaintext
const trustLevel = helper.attrs.user_trust_level;
const trustLevelName = trustLevel ? Discourse.Site.currentProp('trustLevels').findBy('id', trustLevel).name : '';

```

But I noticed that if user has trust level zero it will not give me the name “new user” rather the empty string. Why ` helper.attrs.user_trust_level` is not defined for new users?  
Thank you 🙂

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [February 14, 2020, 10:40am UTC](https://meta.discourse.org/t/understanding-how-trust-level-works/141593/2 "2020-02-14T10:40:15Z")

</div>

You could easily handle that case by modifying your first list to

```javascript
const trustLevel = helper.attrs.user_trust_level || 0;

```

And your second line would be much faster like so

```javascript
Discourse.Site.currentProp('trustLevels')[trustLevel].name

```
