Assigning mod status to multiple users

AI-generated summary

In a discussion titled “Assigning mod status to multiple users,” MihirR asks if bulk moderator assignment is possible — for example, by filtering users via email domain. Canapin replies that while the Discourse interface doesn’t support this, it can be achieved via the API or a Rails script, jokingly asking if Mihir is “building an army.” Mihir clarifies he’s just testing scripts for learning purposes. He notes the Discourse API docs lack relevant endpoints, prompting Canapin to explain that the docs are incomplete and suggests reverse-engineering the API using this guide. Canapin also cautions that Rails scripts, while powerful for bulk operations, should be used carefully to avoid unintended consequences, and shares a resource with script examples. MihirR thanks them, noting he’s previously worked with Discourse APIs but is now testing them thoroughly to explore their full potential.

Is there a way to assign mod status to multiple users at once, for example, by grouping users based on certain criteria? Let’s say, I want to assign mod status to all users with the @example.com email domain. Is it possible to perform bulk mod assignment in this manner?

This is not possible from the interface as far as I know, but can be done using the API or a rails script.

How many users must you promote to moderators to justify using an automated task? Are you trying to build an army ? :stuck_out_tongue:

Hahaha, no, I was just trying to test some scripts using mod status. :rofl:

There was no occurrence of this in the Discourse API, so now would have to check it out manually.

Rails scripts must certainly be done with caution, and many would say it’s better not to rely on this method to “do stuff” as it can easily go wrong.

That said, IF done with care, IF you know what you’re doing, it’s a powerful tool to do various bulk tasks.

Some scripts examples can be found there:

This documentation is incomplete, and will likely always be. Almost every action on Discourse uses the API. If you’re not finding what you’re looking for here, the best is reverse-engineering the API. It’s quite easy to do:

Thanks for sharing! I’ve worked with Discourse APIs before, but now I’m testing them thoroughly to see what’s the best I can build from this.