Reputation: 6380
Is there a way to do the following:
Essentially the idea is to encourage users to log in and update the website.
I've found this plugin which gives me the last login time. I can also use wp_mail();
to send emails but how would I trigger all that / continually check it the last login date?
Upvotes: 1
Views: 1811
Reputation: 896
With the plugin you mentioned, you'll have a new database column in your wp_users
table, which gives you a good starting point.
Next, as @bswatson mentioned, you can leverage WP Cron to run a task that checks for inactive users (if low site traffic is a concern, you might consider setting up WP Cron to use a real cron job). The daily task would look something like this:
Collect all users from the database who haven't logged in in the last X days or more.
Loop through the users, emailing them using wp_mail()
to nudge them to log in.
Good luck!
Upvotes: 1
Reputation: 467
WordPress has a built in system called WP Cron which mimics a system cron, but can be set up and configured directly in code. There are some drawbacks, such as needing traffic to kick of a task.
Here's a pretty thorough breakdown of how WP Cron works including some ways to workaround the issues.
Upvotes: 0
Reputation: 316
Well it depends on what options you have on your hosting. I don't know how to do it purely in WordPress (and I don't know if something like that is possible).
But I would use some cron
job to run some small script. If you can use system cron, of course.
EDIT: I found this WP plugin. But as I suspected, it depends on users visiting your website. So if you want to send emails independently on your website traffic, then you need to use some OS solution.
Upvotes: 0