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


(Tobias Eigen) #1

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.


(Régis Hanol) #2

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

Create an automatic pathway to TL1 and TL2 for email only users
(Tobias Eigen) #3

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