My client wants members on their site to regularly update their profiles (to prevent them going stale), and I've been thinking about the best way to handle notifications for this. One idea was a simple 'subscription' model, where after a certain time has elapsed from the last update (say 3 months), if a profile has remains unedited, ee sends out an email to the member encouraging them to log in and update it. The site is free, so there's no need for payment gateways... so Cartthrob's subscription handling would be overkill. I also looked at Memberr, but again it's too complex for this simple task. I'm just really wondering how best to automatically check member accounts regularly and send notifications to account holders.
One idea might be to have a hidden template that I request nightly with a cron that queries account dates and sends out automated notifications that way? My only issue with that is that it's not really handled within the CP. I don't have any experience of developing modules, only plugins.
I'm planning to use Zoo visitor to handle member data rather than the native member module (don't know if this makes any difference!)
If anyone has any experience of doing something like this I'd love to hear how you handled it!
Sure. The tough part is determining when they have in fact updated their profile. Since you're using Zoo Visitor, you could use the "last updated" date of their member channel entry, but what if it was an admin who updated it - does that make a difference?
Regardless, here's the broad strokes (no code) for an add-on that would notify users every X interval, asking them to update their profiles (not necessarily based on when the last update was actually made). It should give you the the gist of how it would work.
- Create a custom module and extension (start at pkg.io, and read the module docs and extension docs)
- Create a new database table (say,
exp_members_last_updated), which has two columns,
last_updated (this will store a UNIX timestamp)
- Use the
member_delete extension hooks to insert/remove each member into/from your table as they are created/deleted
- Write a function/method in your module file which queries your table, grabbing all
last_updated is at least X seconds ago
- For each of those, grab their email address from
exp_members, and send them an email (using EE's Email class)
- After sending the email, update their record in your custom table with the current time (
- That module needs to have an "action", which is linked to the above method within your module class - then you can run the script as a cron job with
I would use Postmaster for this. You are going to have to write some code either way, so you might as well harness a proper API that was build exactly for this same thing. I would use the Notifications API. You could even follow similar logic to Derek, as I have done the same exact thing with CartThrob Abandoned Cart Notifications. So instead of CT Abandoned Shopping Carts, you would just use similar logic to create an "Outdated Member Profiles" Notification.
Best part about this, is you don't even have to write the code to send the email. Postmaster does all that for you. You just need to write the logic to figure out which users need a notifications.
Though you should probably build this as an EE add-on you don't technically need to.
You could write a simple PHP script that queries EE's database and grabs the email address of any account that hasn't been updated. Then send an email using PHP's own email functions. It doesn't have to be anything to do with EE.
The trick is going to be how to determine when a profile was last updated as I'm not sure this info is stored anywhere.