# List of users with locked trust level due to group membership?

**URL:** <https://meta.discourse.org/t/list-of-users-with-locked-trust-level-due-to-group-membership/62455>\
**Category:** Data & reporting\
**Tags:** sql-query\
**Created:** [2017年五月10日 18:36 UTC](https://meta.discourse.org/t/list-of-users-with-locked-trust-level-due-to-group-membership/62455 "2017-05-10T18:36:18Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)\
**Post date:** [2017年五月10日 18:36 UTC](https://meta.discourse.org/t/list-of-users-with-locked-trust-level-due-to-group-membership/62455/1 "2017-05-10T18:36:18Z")

</div>

I was just investigating an issue with trust levels, and realized that a handful of moderators had their trust level locked and I don’t know why. Does this happen automatically when you promote someone to moderator or shouldn’t their trust levels adjust automatically as they move along and up in the community food chain? Or are there other circumstances when trust levels get locked by the system, not manually by staff?

I worry that other users might have their trust levels similarly locked inadvertently. To ease my concerns I have been hunting for a way to see a list of users with locked trust levels, but to no avail. If this feature exists, please point me to it. The easiest way may be to include it as a column in the user export. Or perhaps someone knows a database explorer query they can share?

Many thanks in advance. 🌱

---

<div class="post-metadata">

**Author:** ![grahamperrin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/grahamperrin/32/71406_2.png) [@grahamperrin](https://meta.discourse.org/u/grahamperrin)\
**Post date:** [2017年五月10日 18:54 UTC](https://meta.discourse.org/t/list-of-users-with-locked-trust-level-due-to-group-membership/62455/2 "2017-05-10T18:54:42Z")

</div>

Is each lock logged and if so, is the lock presented as a filter that can apply?

---

<div class="post-metadata">

**Author:** ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)\
**Post date:** [2017年五月10日 19:06 UTC](https://meta.discourse.org/t/list-of-users-with-locked-trust-level-due-to-group-membership/62455/3 "2017-05-10T19:06:19Z")

</div>

Using [Data Explorer](https://meta.discourse.org/t/32566?silent=true), you can query them using.  
[locked-trust-levels.dcquery.json](https://global.discourse-cdn.com/meta/original/3X/3/2/322ed6de24b9ec18a5c023374fddea8914cf5868.json) (184 Bytes)

---

<div class="post-metadata">

**Author:** ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)\
**Post date:** [2017年五月10日 19:09 UTC](https://meta.discourse.org/t/list-of-users-with-locked-trust-level-due-to-group-membership/62455/4 "2017-05-10T19:09:42Z")

</div>

that’s a good idea - I checked, however and there is no admin action log for “locked trust level”.

> [@cpradio](#):
>
> Using [Data Explorer](https://meta.discourse.org/t/32566?silent=true), you can query them using.  
> locked-trust-levels.dcquery.json (184 Bytes)

cool! I’d like to try this but am realizing I am unable to import data queries - clicking the button nothing happens. Am I missing something or is this a bug?

---

<div class="post-metadata">

**Author:** ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)\
**Post date:** [2017年五月10日 19:11 UTC](https://meta.discourse.org/t/list-of-users-with-locked-trust-level-due-to-group-membership/62455/5 "2017-05-10T19:11:38Z")

</div>

That is indeed a bug.

 ![](https://global.discourse-cdn.com/meta/original/3X/f/b/fb0d4729eefaf2e1d75405177585bca56cb08edb.png)

In the meantime this is the query:

```plaintext
SELECT username, trust_level from users WHERE trust_level_locked = true

```

---

<div class="post-metadata">

**Author:** ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)\
**Post date:** [2017年五月10日 19:22 UTC](https://meta.discourse.org/t/list-of-users-with-locked-trust-level-due-to-group-membership/62455/8 "2017-05-10T19:22:17Z")

</div>

ok - after refreshing a few times and clicking around in the query explorer I finally got the option to create a new query.

This is super helpful - many thanks. According to your query, it looks like I have 351 users with locked trust levels. This is a fairly random list of users who don’t have anything in common, and they have not been edited.

Any idea why this is happening?

Would you be willing to provide me with a command to reset these to unlocked? Or do I need to go through and unlock each of these one by one?

---

<div class="post-metadata">

**Author:** ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)\
**Post date:** [2017年五月10日 19:27 UTC](https://meta.discourse.org/t/list-of-users-with-locked-trust-level-due-to-group-membership/62455/9 "2017-05-10T19:27:26Z")

</div>

Ohhh… I think I have an idea what’s happening here. I have been using the group feature to automatically grant a trust level when they are added. Is it possible that this has been actually locking them at this trust level? This is not what I want, and it’s not what I think the feature does. But I can’t think of anything else at the moment.

 ![](https://global.discourse-cdn.com/meta/original/3X/4/7/4751f1a3e835a5a0d3ac4a84c6bc87edd435dfce.png)

---

<div class="post-metadata">

**Author:** ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)\
**Post date:** [2017年五月10日 20:27 UTC](https://meta.discourse.org/t/list-of-users-with-locked-trust-level-due-to-group-membership/62455/10 "2017-05-10T20:27:11Z")

</div>

That may be doing it. IIRC, when TL is set higher than what the user currently qualifies for, it locks them in to prevent the system from downgrading them.

---

<div class="post-metadata">

**Author:** ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)\
**Post date:** [2017年五月10日 20:29 UTC](https://meta.discourse.org/t/list-of-users-with-locked-trust-level-due-to-group-membership/62455/11 "2017-05-10T20:29:20Z")

</div>

> [@tobiaseigen](#):
>
> Would you be willing to provide me with a command to reset these to unlocked?

I’m not at a computer right now. I imagine out would be easiest to do via command line but after reading your other post I’m not positive it is a good idea to do so.

---

<div class="post-metadata">

**Author:** ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)\
**Post date:** [2017年五月10日 23:22 UTC](https://meta.discourse.org/t/list-of-users-with-locked-trust-level-due-to-group-membership/62455/12 "2017-05-10T23:22:26Z")

</div>

Thanks! I think I’d rather have the automatic trust level system work than have people locked at a low trust level. So if you can provide the command when you get a chance I’d appreciate it. 🌱

---

<div class="post-metadata">

**Author:** ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)\
**Post date:** [2017年五月11日 02:08 UTC](https://meta.discourse.org/t/list-of-users-with-locked-trust-level-due-to-group-membership/62455/13 "2017-05-11T02:08:17Z")

</div>

I believe this should do it. (be sure to backup your instance before running it)

```plaintext
User.where(trust_level_locked: true).update_all(trust_level_locked: false)

```

Edit:  
Well, duh! You could simplify this to (as no user should have a locked TL)

```plaintext
User.update_all(trust_level_locked: false)

```

---

<div class="post-metadata">

**Author:** ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)\
**Post date:** [2017年五月11日 18:18 UTC](https://meta.discourse.org/t/list-of-users-with-locked-trust-level-due-to-group-membership/62455/17 "2017-05-11T18:18:56Z")

</div>

> [@cpradio](#):
>
> That may be doing it. IIRC, when TL is set higher than what the user currently qualifies for, it locks them in to prevent the system from downgrading them.

To come full circle here - if this is the case, then I suggest updating the helper text for that group setting, from this:

**Trust level automatically granted to members when they’re added**

to something like this:

**Trust level members are automatically granted (and locked at) when they’re added.**

---

<div class="post-metadata">

**Author:** ![Bkhanaliloo](https://avatars.discourse-cdn.com/v4/letter/b/3bc359/32.png) [@Bkhanaliloo](https://meta.discourse.org/u/Bkhanaliloo)\
**Post date:** [2018年一月16日 20:38 UTC](https://meta.discourse.org/t/list-of-users-with-locked-trust-level-due-to-group-membership/62455/18 "2018-01-16T20:38:46Z")

</div>

If a user with locked trust level moved to a new group, what would happen to the trust level? Does he/she will be granted the new automatic trust level based on the group settings?

I am trying to understand if system is able to adjust the trust level based on the group settings, when trust level is locked for the user. I can see in my log that system attempted to change the trust level, but new and old trust levels are the same.

---

<div class="post-metadata">

**Author:** ![danekhollas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/danekhollas/32/79637_2.png) [@danekhollas](https://meta.discourse.org/u/danekhollas)\
**Post date:** [2018年三月21日 02:06 UTC](https://meta.discourse.org/t/list-of-users-with-locked-trust-level-due-to-group-membership/62455/19 "2018-03-21T02:06:45Z")

</div>

I would be in favor of a site setting that would prevent this behavior. I have a non-negligible amount of trusted users, which I want to invite to the forum, automatically grant them member status by adding them to a group via domain filter. But I still want them to be able to advance to TL3 and TL4. Or is this a foolish strategy?

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)\
**Post date:** [2020年七月17日 19:59 UTC](https://meta.discourse.org/t/list-of-users-with-locked-trust-level-due-to-group-membership/62455/20 "2020-07-17T19:59:26Z")

</div>



---

<div class="post-metadata">

**Author:** ![k4rtik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/k4rtik/32/119508_2.png) [@k4rtik](https://meta.discourse.org/u/k4rtik)\
**Post date:** [2020年九月4日 11:19 UTC](https://meta.discourse.org/t/list-of-users-with-locked-trust-level-due-to-group-membership/62455/21 "2020-09-04T11:19:32Z")

</div>

我来到这里是为了寻找类似问题的答案。

如果一个用户被从授予其更高信任等级的群组中移除，他们的信任等级会发生什么变化？

如果他们不再符合更高信任等级的资格，会被降级到较低等级吗？还是会保持在同一等级（但会被锁定，无法晋升或降级？还是仅会被降级？）？

---

<div class="post-metadata">

**Author:** ![satonotdead](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/satonotdead/32/447830_2.png) [@satonotdead](https://meta.discourse.org/u/satonotdead)\
**Post date:** [2023年三月20日 20:12 UTC](https://meta.discourse.org/t/list-of-users-with-locked-trust-level-due-to-group-membership/62455/22 "2023-03-20T20:12:47Z")

</div>

谢谢您的回复！

**查询似乎已更改？**

---

<div class="post-metadata">

**Author:** ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)\
**Post date:** [2023年四月30日 12:04 UTC](https://meta.discourse.org/t/list-of-users-with-locked-trust-level-due-to-group-membership/62455/23 "2023-04-30T12:04:10Z")

</div>

查看一下 explorer 表格，似乎现在有了 `manual_locked_trust_level` 和 `group_locked_trust_level`，如果您需要制作更新版本，这或许能帮到您？

---

<div class="post-metadata">

**Author:** ![satonotdead](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/satonotdead/32/447830_2.png) [@satonotdead](https://meta.discourse.org/u/satonotdead)\
**Post date:** [2023年四月30日 15:16 UTC](https://meta.discourse.org/t/list-of-users-with-locked-trust-level-due-to-group-membership/62455/24 "2023-04-30T15:16:16Z")

</div>

这招奏效了！

```plaintext
SELECT username from users WHERE manual_locked_trust_level = 1

```

---

<div class="post-metadata">

**Author:** ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)\
**Post date:** [2023年六月8日 10:19 UTC](https://meta.discourse.org/t/list-of-users-with-locked-trust-level-due-to-group-membership/62455/25 "2023-06-08T10:19:46Z")

</div>


