Nagging users who have trouble logging in

Sadly, we have a number of users on our website that struggle to log in regularly and update their pages. For a while, when we only had two or three pages of users, we’d have someone look through the user list once in a while and get in touch with anyone who hadn’t logged in. But that’s grown impractical with seven pages of users. So we decided to add a cron task to send email reminders for us.

My first though was to query for users who hadn’t edited a page in a while:

But then I realized that was no good – we have too many users that log in every couple of weeks to check form responses, but who never edit pages. So I rewrote the query to look for recent logins, then wrapped that in a Python script run by system cron:

If you have a terribly complex database layout in your settings file, then this probably won’t work and you’ll have to do a proper rewrite of the section that finds DB credentials. Don’t forgot to add a simple list of users who should be excluded (for us, this includes training users and a couple of third parties), and to add your email settings.

Our cron job runs on the first of every month. Once four months have passed, rather than emailing the user, we email the name to our web content manager, who provides a more personal touch in connecting with the user in question.

©2018 Kyle Schmidt some rights reserved