Is there a way to retroactively update trust level and title for existing group members?

AI-generated summary

tobiaseigen is seeking a way to retroactively update trust levels and titles for existing group members in a group of 70+ trusted members. zogstrip provided a solution using the rails console, where the id of the group is required. The process involves retrieving user IDs from the group, updating titles and trust levels accordingly. tobiaseigen successfully applied the solution without any issues.

I have a group of 70+ trusted members who I’d like to give TL1 privileges and a title. I see it’s possible to set it up to set the trust level and title for new members as they are added to the group, but this does not appear to affect existing group members. Is there a way to retroactively process these members?

I’d be grateful for any guidance. :seedling:

Below is how the group is set up now.

The only way is to use the rails console. You will need the id of the group.

cd /var/discourse
./launcher enter app
rails c
user_ids = GroupUser.where(group_id: <group_id>).pluck(:user_id)
User.where(id: user_ids).where("LENGTH(COALESCE(title, '')) = 0").update_all(title: "awesome title")
User.where(id: user_ids).where(trust_level: TrustLevel[0]).update_all(trust_level: TrustLevel[1])

cool! thanks much. I tried this and it appears to have worked without a hitch! w00t! :rocket: