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

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.

1 Like

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])
2 Likes

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

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.