Jump to content

whmcs trial 30 days, then bill sent?


gaogier

Recommended Posts

Hello

 

Is there an addon for this, not sure the addon i downloaded would work.

 

I need a whmcs 90 day trial.

 

The plan.

 

Users join, use our promotion key and get 90 days worth of hosting free.

 

This would be a trial hosting account, they can leave before its up. If they don't I want them to have a bill sent to them.

 

Is there something like this already around?

Link to comment
Share on other sites

Hi guys,

 

I want to use the Official Free Trials mod but instead of terminating the trial account after it expires i would like to suspend the account. Then if the customer just forgets to upgrade i still have their account on the server if they come bak so i can just unsuspend them and save time.

 

I think it should be fairly simple to change the command from terminate to suspend in the action hooks code but im not a coder and dont really have the first idea where to look to do this. Could someone please tell me how to do this.

 

Thanks in advance

Link to comment
Share on other sites

If the upgrade reminder email is sent once the account trial has finished, the account is terminated so I find the official trials mod, as it is right now, a little bit useless.

 

It would be nice to send an email X days prior the end of the trial so that the client has enough time to decide either they want to pay for the account or leave.

Link to comment
Share on other sites

Just in case someone is interested, I've modified the original code to send the email X days after the signup, and Y days after the signup to terminate the account (IMHO, just the way it should work).

 

If anyone wants to test it, here it is:

 

<?php

function end_free_trials_hook($args) {
   if (!function_exists("ModuleBuildParams")) require(ROOTDIR."/includes/modulefunctions.php");

   # Duplicate the free trials array for each trial product you want to offer entering the
   # product id, how many days to allow and email template to send when the trial period ends

   $freetrials[] = array(
    "pid" => "1",
    "days" => "15",
 "days_email" => "10",
    "email_subject" => "Aviso Hosting Prueba",
   );

   # Do not edit below this line

   foreach ($freetrials AS $data) {
       $pid = $data["pid"];
       $days = $data["days"];
       $email_subject = $data["email_subject"];
       $trialexpiry = date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$days,date("Y")));
       $emailexpiry = date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$days_email,date("Y")));

       $query = "SELECT tblhosting.id,tblproducts.servertype FROM tblhosting INNER JOIN tblproducts ON tblproducts.id=tblhosting.packageid WHERE packageid=".(int)$pid." AND domainstatus='Active' AND regdate<'$emailexpiry'";
       $result = full_query($query);
       while($data = mysql_fetch_array($result)) {
   	    $id = $data["id"];
           $module = $data["servertype"];
           if (!function_exists($module."_ConfigOptions")) require_once(ROOTDIR."/modules/servers/$module/$module.php");
           sendMessage($email_subject,$id);
       }

       $query = "SELECT tblhosting.id,tblproducts.servertype FROM tblhosting INNER JOIN tblproducts ON tblproducts.id=tblhosting.packageid WHERE packageid=".(int)$pid." AND domainstatus='Active' AND regdate<'$trialexpiry'";
       $result = full_query($query);
       while($data = mysql_fetch_array($result)) {
   	    $id = $data["id"];
           $module = $data["servertype"];
           if (!function_exists($module."_ConfigOptions")) require_once(ROOTDIR."/modules/servers/$module/$module.php");
           ServerTerminateAccount($id);
       }

}
}

add_hook("DailyCronJob",1,"end_free_trials_hook","");

?>

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