mcpacific Posted December 11, 2009 Share Posted December 11, 2009 I was looking around for support for a way to offer free trials for multiple products, each with a different trial period, reminder email and termination email and I thought the easiest way to do that would be to modify the official WHMCS free trial mod (action hook) by adding a couple variables and adding some additonal code: First, adding two variables to the $freetrials array: "reminderdays" => "25", "reminderemail" => "Whatever Product Trial Reminder", Then, adding an additional foreach loop (above the original): # First, check to see if any reminders need to be sent foreach ($freetrials AS $data) { $pid = $data["pid"]; $reminderdays = $data["reminderdays"]; $reminderemail = $data["reminderemail"]; $trialreminder = date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$reminderdays,date("Y"))); $query = "SELECT * FROM tblhosting WHERE packageid=".(int)$pid." AND domainstatus='Active' AND regdate='$trialreminder'"; $result = full_query($query); while($data = mysql_fetch_array($result)) { $id = $data["id"]; sendMessage($reminderemail,$id); } } This way you can offer as many free trials as you wish, each with varying lengths and completely unique emails. Enjoy! 0 Quote Link to comment Share on other sites More sharing options...
resoster Posted December 12, 2009 Share Posted December 12, 2009 nice thank you very much 0 Quote Link to comment Share on other sites More sharing options...
isixhosting Posted March 9, 2010 Share Posted March 9, 2010 I was looking around for support for a way to offer free trials for multiple products, each with a different trial period, reminder email and termination email and I thought the easiest way to do that would be to modify the official WHMCS free trial mod (action hook) by adding a couple variables and adding some additonal code: First, adding two variables to the $freetrials array: "reminderdays" => "25", "reminderemail" => "Whatever Product Trial Reminder", Then, adding an additional foreach loop (above the original): # First, check to see if any reminders need to be sent foreach ($freetrials AS $data) { $pid = $data["pid"]; $reminderdays = $data["reminderdays"]; $reminderemail = $data["reminderemail"]; $trialreminder = date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$reminderdays,date("Y"))); $query = "SELECT * FROM tblhosting WHERE packageid=".(int)$pid." AND domainstatus='Active' AND regdate='$trialreminder'"; $result = full_query($query); while($data = mysql_fetch_array($result)) { $id = $data["id"]; sendMessage($reminderemail,$id); } } This way you can offer as many free trials as you wish, each with varying lengths and completely unique emails. Enjoy! Hi, to which file should I add the code? 0 Quote Link to comment Share on other sites More sharing options...
isixhosting Posted March 9, 2010 Share Posted March 9, 2010 I would like to use it not for hosting accounts but for a trial software installation on the server. It's a 60 days trial, I just needthe reminder to be sent before the expiration date. How can I do it? Thanks 0 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.