Moderators mark1million Posted November 6, 2011 Moderators Report Share Posted November 6, 2011 Gents, I am after modifying this code to be able to use it via an external php page and run as a cron to auto retire a pilot who has not flown an initial flight within 7 days of joining. I am also looking at when removing them from active to changing their email as i have had complaints about every time the maintenance cron is run all inactive pilots keep getting the retired email. This is what i thought, move their existing email to the admin notes field and leaving their mail as blank, that will stop emails then when they want to rejoin all an adminn has to do is update their email from that notes box and move to active. I don't mind paying someone if required. <?php if ($userinfo->lastpirep == '0000-00-00 00:00:00') { echo '<p id="error">You have not yet flown any flights!<br />Please be aware that you must file a pirep within 7 days of joining or your account will be deactivated.</p>'; } else { $datebefore1 = substr($userinfo->lastpirep, 0, 10); $datetoday2 = date("Y-m-d"); $datebefore3 = strtotime($datebefore1); $datetoday4 = strtotime($datetoday2); $newdate = $datetoday4-$datebefore3; $lastpirep = floor($newdate/(60*60*24)); $daysleft = $totaldays-$lastpirep; echo '<p id="success">Your last flight was '; if ($lastpirep == 0) { echo 'today'; } else if ($lastpirep == 1) { echo 'yesterday'; } else { echo $lastpirep . ' day(s) ago.'; } echo ' You have '; if ($daysleft == 5000) { echo ''; } else { echo $daysleft . ' days left until you are marked as retired'; } } ?> <?php } ?> Quote Link to comment Share on other sites More sharing options...
Moderators Kyle Posted November 6, 2011 Moderators Report Share Posted November 6, 2011 There should be a way to stop sending those emails when they are already retired. Perhaps, you can add a counite line like $pilot->retired == 1 (continue) (NOT THE RIGHT CODE) And it will send email out to who hasn't been retired and didn't fly a flight on it's parameters' days. Are you running the Maintenance Cron Job right? Quote Link to comment Share on other sites More sharing options...
Moderators Kyle Posted November 6, 2011 Moderators Report Share Posted November 6, 2011 Did little more in look in the PilotData.class. on Line 811 foreach($results as $row) { // Set them retired self::updateProfile($row->pilotid, array('retired'=>1)); Template::Set('pilot', $row); $pilot_retired_template = Template::Get('email_pilot_retired.tpl', true, true, true); Util::SendEmail($row->email, Lang::get('email.pilot.retired.subject'), $pilot_retired_template); } } However, this is where you should be looking for. If I'm right? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.