Jump to content

Inactive Member Script


Andrew R

Recommended Posts

Inactive Member Script

 

I’m considering writing an inactive member script.  For example if a user doesn’t log in for 30 days (1 month) or more they will receive an email.  I’m struggling to work out how a script like this would work with any user input from the admin.  Also things like dates.  How would the system count back 30 days, i.e if the date is 2007-04-07, how would I count back 30 days?

 

Any ideas would be much appreciated

 

Cheers

Link to comment
Share on other sites

in the database have a field for last login, when the member logs inn, set that to the current time/date

 

then to find member who haven't logined in just search in the database field for todays date minus 30days

 

<?php
$nextWeek = time() + (7 * 24 * 60 * 60);
                   // 7 days; 24 hours; 60 mins; 60secs
echo 'Now:       '. date('Y-m-d') ."\n";
echo 'Next Week: '. date('Y-m-d', $nextWeek) ."\n";
// or using strtotime():
echo 'Next Week: '. date('Y-m-d', strtotime('+1 week')) ."\n";
?>

Link to comment
Share on other sites

to actually do the email stuff

 

if($then => $now) {

  $set _mail_param = "EMAIL BODY";

  # set email params etc here

  mail($params_in_here);

  #id write to a database that the email was sent $now;

}

 

# then id check if the email was sent 30 days abo, then id suspend account or something

if( $mail_time =< $then) { #youd do other stuff to get then and now

  do stuff to database to the account_status field or something

}

 

pm me if your confused

 

 

good luck

Link to comment
Share on other sites

there are plenty of threads about crons, but the basics are:

 

if you run windows, its exactly like a "scheduled task

 

may hosts offer them, and its as simple as telling them where the script is, and how often to run it......... or you may have to code the cron your self, in which google would be the best place to get a quick tutorial........

 

 

you can simply set it to run every week, day, month, what ever you like, and even at specific times during the day.......

 

 

so simply write your script, and "cron" it

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.