Change all exsisting users to trust level 2

(Konstantinos Karatsevidis) #1

Hi there!

We have recently started using Discourse and our community is growing quite fast
Right now we want to reward all of the existing users with possibility to invite their friends. I have 2 questions i tried everything possible already :slight_smile:

  1. Can we allow all of the users including trust level 0 to invite others?
  2. In case if answer to the first question is no, then how can we make all the users level 2 by default (not the new ones but the existing ones) How can we do that except for one by one.

Help is very appreciated guys!

(Régis Hanol) #2

Nope, this is tied up to the user’s trust level and is not configurable.

We can run a SQL query to update all the existing users to TL2.

(Konstantinos Karatsevidis) #3

Great ! Would you run it guys? Would appreciate your help!

(Régis Hanol) #4

Done. Everyone is now at least Trust Level :two:

(Konstantinos Karatsevidis) #5

Thank you very much !

(Régis Hanol) #6

(Jeff Atwood) #7

@zogstrip can you document the exact Rails command to do this here so others who find the topic might be able to do this on their own instance? :wink:

(Régis Hanol) #8

Sure. Here’s what I did since they had less than 1000 users

User.where(trust_level: [0, 1]).find_each do |user|

This is slow, but ensures that locked trust levels aren’t changed.

If there were more than 1000 users, I would have used this instead

User.exec_sql("UPDATE users SET trust_level = 2 WHERE trust_level IN (0, 1)")

Trust level changes while automatic groups do not change
About trust level?
Missing "Invite Others..." button in PM