# 自动群组所有者组

**URL:** <https://meta.discourse.org/t/an-automatic-group-of-group-owners/144633>\
**Category:** Feature\
**Created:** [2020年三月17日 19:52 UTC](https://meta.discourse.org/t/an-automatic-group-of-group-owners/144633 "2020-03-17T19:52:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)\
**Post date:** [2020年三月17日 19:52 UTC](https://meta.discourse.org/t/an-automatic-group-of-group-owners/144633/1 "2020-03-17T19:52:02Z")

</div>

有没有一种方法可以创建一个自动分组，包含所有群组所有者，就像 [@staff](https://meta.discourse.org/groups/staff) 那样？

我想将所有群组所有者设为 TL2，并随着我的网站（希望）快速增长来跟踪他们。此外，我还想随着时间的推移以群组为单位调整他们的权限，与他们沟通，并为他们设立一个专属分类。我不想直接让他们全部成为版主，因为他们目前还尚未准备好。

目前，我可以手动操作；但随着我们管理严格的论坛不断壮大，一个自动分组会变得越来越有帮助。

或者，如果将其做成插件，实现起来会有多困难？

---

<div class="post-metadata">

**Author:** ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)\
**Post date:** [2022年八月13日 02:33 UTC](https://meta.discourse.org/t/an-automatic-group-of-group-owners/144633/2 "2022-08-13T02:33:43Z")

</div>

我刚刚实现了一个 [Creating triggered custom badge queries](https://meta.discourse.org/t/triggered-custom-badge-queries/19336) 来识别当前群组所有者。

SQL 如下（也可在 [Data Explorer](https://meta.discourse.org/t/32566?silent=true) 中使用）：

```sql
SELECT DISTINCT user_id, owner, CURRENT_TIMESTAMP granted_at
FROM group_users
WHERE group_users.owner = true

```

它使用了 `CURRENT_TIMESTAMP`，因为我没有在数据库中找到方便的群组所有权时间戳。也没有方便的触发器，所以 `:backfill` 可以省略。

我建议进行以下配置：

1. 每天运行撤销查询
2. 触发器：每日更新
3. 我不确定“可以多次授予”  
该查询只为每个用户触发一次，所以不会多次授予。但是，一旦被撤销，可能需要再次授予徽章——不确定！
