Suspending the user through the Discourse API might be a good way to automate this. When a user is suspended, they are logged out of Discourse and they will no longer be send digest emails. If a message is given when the user is suspended, that message will be sent as an email to the user. This could be used to encourage them to renew their membership.
One thing to note is that suspension was designed to handle difficult users, it wasn’t designed to handle the case of an expired membership that may be renewed in the future. You may find that you need to customize your site’s user_notifications.account_suspended.text_body_template text to customize the template of the email that is sent to suspended users.
Posts created by an anonymized user look like this:
There is no easy way to un-anonymize a user. The only approach I know of is to merge the anonymous user with a new user from the Rails console. Since anonymizing a user removes all identifying data from the user, it could be hard to know which accounts to merge. If there is a chance that users will renew their memberships, suspending the user is probably a better approach.
