How might I list users that the system will soon delete?

We’ve a default setup for the system to clean inactive users. I believe the default criteria are something like:

  • last_posted_at date (never posted),
  • TL0
  • not seen for (by default) 2 years

These criteria generally work very well in cleaning out the user base.

But is there a way to produce a list showing admins users that the system will delete in the future? We’d like to communicate with some highly valued but inactive users with reasons to stay with us.

1 Like

Hi Amicable!

Using data explorer, the query would be:

WITH posts_by_user AS (
    SELECT COUNT(*) AS posts, user_id
    FROM posts
    GROUP BY user_id
)
SELECT 
    u.id,
    u.username_lower AS "username",
    u.created_at,
    u.last_seen_at
FROM users u
LEFT JOIN posts_by_user pbu ON pbu.user_id = u.id
WHERE u.active = true and u.trust_level = 0
AND posts IS NULL
ORDER BY u.id

That looks very useful. I didn’t know about the data explorer, so will start there. Thank you very much for your solution :+1:

Out of curiosity, what is the purpose? Admins usually are active, post and log in.

edit: I might have misunderstood this part:

:slight_smile:

In this case, just remove and admin = true from the SQL query.


I updated the SQL code directly.

1 Like

It’s for a list showing us admins users.

But the wider use case is maybe interesting. We use email digests quite a lot because some of our community are valued but busy older people unlikely to post and less likely to log in. But they are very familiar with email and they like to remain updated.

But suddenly after 2 years :boom: and we can’t get back in touch with them.

Oh, I see. Basically, they read by email and browse logged off pretty much all the time.

I’m not sure how to handle that. Surely someone will have a good idea. A straightforward one would for them to at least post 1 message on the forum, though.

Also, note that digests are disabled for users that didn’t log in after 180 days (default value). The setting’s name is suppress digest email after days.

1 Like

yes, exactly. It would be nice if they posted once. But imagine someone extremely time poor and really bad with technology. Yet highly valued. The digests are superb for them and the community knows they belong & doesn’t mind they don’t actively contribute online.

You can change their trust level and lock it to another value than 0. :slight_smile:
It will prevent them from being picked up by the cleanup inactive user jobs.

2 Likes

The simplest solutions are the best :tada:

1 Like

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