"Users waiting for approval" messages after migration

About 8 months ago, I migrated a Yahoo group to a new Discourse installation by downloading .mbox files from Yahoo and importing them into Discourse. The import went well and, though not an especially-active community, the users seem to like the new format. But the old group had been around for nearly 20 years, which leads to its own issues.

Many of the members of the group over its lifespan have email addresses that are no longer valid (and in some cases, they have died). And this may be why I’m getting a system message periodically telling me there are somewhere around 385 users waiting for approval, like this:

But when I click on the “Please review them” link, I get this instead:

It’s hardly a major issue, but it is mildly annoying–is there a way to fix this?


@tshenry is there a way to remove these from the command line perhaps?


There are a few things you can do here. The easiest would be to set the following site setting to -1:

The only downside is that you won’t get reminded if there are pending users that have been waiting for the specified number of hours. As long as someone is usually around that can approve new users, it shouldn’t be a problem.

The alternative would be to either delete or approve the users from the command line. Let me know if one of these approaches is preferred. I can work up the commands for you on either.


I think bulk-approving them might be better. The site isn’t super-active, so I’m not on there every day to approve new users. Thanks for the help.


Ok cool, here’s what you can do to handle your specific case:

  1. Approve/reject any pending users that are currently visible in your review queue

  2. Take a backup of your site

  3. Enter the rails console of your site

    cd /var/discourse
    ./launcher enter app
    rails c
  4. Get the users that are in approval limbo

    pending_users = AdminUserIndexQuery.new(query: 'pending', stats: false).find_users_query
  5. Run the following to approve them

    pending_users.each do |u|
      u.approved = true
      u.approved_by = Discourse.system_user
      u.approved_at = Time.zone.now

That should do it!


That does seem to have done it, thanks. If not, I should know pretty shortly.


Now it’s three weeks later (sorry), and I haven’t seen the message again. Yes, that fix did the trick.


What’s would be the command to mass disapprove users?
I imported a vBulletin and have about 100 pending users, all spam accounts. :slight_smile:

1 Like

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