SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Feb 2008
    Posts
    165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Member Status: pending?

    When a member's expiration date is reached, I will need a system of flagging the member record as 'expired'. Easy enough. Then I will fire off an email to the member letting them know their membership is expired.

    What I want to do is send one email on their expiration date, another when they are 10 days expired, another when they're 20 days, and a final notice when they're 30 days.

    I don't want to accidentally email the same people every day, so perhaps if I set the exp date field to 'pending 1' for 1 day expired, and 'pending 2' for two days expired, I could keep them separate and only email the ones I need to.

    I know I'll need to update the records using a scheduler, that's fine.

    Not sure what information I should be updating the records with.

  2. #2
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,083
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    It depends on how many times a day you run the script. If it's just once a day it's pretty easy. Just store the data their account expired in the database (let's assume this field is called `expired`) and check if DATEDIFF(CURRENT_DATE, expired) = 10 (or indeed 20 or 30) and if so, send the email.
    If you run the script multiple times a day you'd need to add another field indicating when you sent the last email and don't send an email if that field holds today's date
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  3. #3
    SitePoint Zealot
    Join Date
    Feb 2008
    Posts
    165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Great answer. And simple to test. Thanks very much!


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •