Bulk delete suspended users after import


After converting a phpBB forum, I have ~700 suspended users. I’d like to delete the ones that also have no posts or topics.

Is there a rails command for that?

(Jeff Atwood) #2

Sure @vinothkannans can advise you on this.

(Vinoth Kannan) #3

For that, you should enter into the container with

./launcher enter app

Then, you will need to launch the rails console with

rails c

Once you’re in the rails console, you can delete all suspended users who have zero posts and topics with

User.joins(:user_stat).where("users.suspended_at IS NOT NULL AND user_stats.topic_count = 0 AND user_stats.post_count = 0").destroy_all

Always make sure you have latest db backup whenever you run destroy_all method.

Bulk deleting / mass modifying users
Deleting user images when using the rails console to delete users