Jump to content

Additional Free Trial Features


mcpacific

Recommended Posts

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!

Link to comment
Share on other sites

  • 2 months later...
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?

Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated