An automatic group of group owners

AI-generated summary

Automatic Group for Group Owners

The discussion revolves around creating an automatic group containing all group owners, similar to the @staff group. nathank wants to assign group owners a specific trust level (TL2) and manage their permissions, communication, and category as the site grows.

As a temporary solution, nathank has created a custom badge query to identify current group owners using the following SQL code:

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

This query uses CURRENT_TIMESTAMP as there is no timestamp for group ownership in the database. nathank suggests running a revocation query daily and triggering an update daily, with uncertainty about the “Can be granted multiple times” configuration.

Is there a way to have an automatic group which contains all group owners, in much the same way as @staff works?

I’d like to make all my group owners TL2, and to keep track of them as my site (hopefully) grows quickly. Also I want to change their powers as a group as time goes on, as well as communicate with them and have a category for them. I don’t want to make them all mods as they aren’t ready for that.

In the meantime, I can do this manually; however as our tightly managed Forum grows an automatic group would become more and more helpful.

Alternatively, how hard would this be to do as a plugin?

7 Likes

I’ve just implemented a Creating triggered custom badge queries for identifying current group owners.

The SQL for it is here (can be used in Data Explorer too)

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

It uses CURRENT_TIMESTAMP as there is no nice convenient timestamp for group ownership in the database that I can see. There is no nice trigger either so the :backfill thing can be omitted

I suggest this config:

  1. Run revocation query daily
  2. Trigger: Update daily
  3. I’m not sure about ‘Can be granted multiple times’
    The query only fires once for each user so multiple won’t be granted. But it might be needed to have the badge granted again once revoked - no sure!
4 Likes