Jump to content

"Complete" Free Trials Mod :)


ExsysHost

Recommended Posts

@jeremyhaber and @mgaccess thank you

 

Have uploaded and modified the code as needed. Haven't yet tested as I'm on vacation but will do so within the next week or so. If you find anything else, please update this thread......I really appreciate the input and help.

 

Si

Link to comment
Share on other sites

  • Replies 68
  • Created
  • Last Reply

Top Posters In This Topic

@jeremyhaber, I assume this was a typo ($withinTime[3] <= 86400 && $withinTime[2] )?

            }elseif ($withinTime[2] <= 86400 && $withinTime[2] > 0) {   
               sendMessage("$warn3",$id);   
           }elseif ($withinTime[3] <= 86400 && $withinTime[2] > 0) {   
               sendMessage("$warn2",$id);                     
           }elseif ($withinTime[4] <= 86400 && $withinTime[3] > 0) {   
               sendMessage("$warn1",$id);   
           }  

 

and should be changed to this:

 

You are correct a slight typo. Sorry about that.

 

@jeremyhaber and @mgaccess thank you

 

Have uploaded and modified the code as needed. Haven't yet tested as I'm on vacation but will do so within the next week or so. If you find anything else, please update this thread......I really appreciate the input and help.

 

Si

 

No problem! You are absolutely welcome.

 

@jeremyhaber I updated the code as you suggested (attached), but the cron job doesn't send any emails at all. I've edited the product registration dates several times just to be sure. Any suggestions? (note the "warndaysX" 2, 4, 6 is just for testing)

 

Modified it slightly on my end removing the database queries and some includes. Since I am running a test file right now on a live server.

 

This is essentially the same logic I included in the file.

http://whmcsaddon.com/myaccount/trial-test.php?date=2011-08-18

 

You may need to change the date variable. This link above is for first warning as of today the 19th.

 

Everything seems to be working correctly. Maybe set a quick PHP mail function to email you and let you know it's at least running. It could very well be that nothing was in the proper date parameters to run and send mail.

Link to comment
Share on other sites

Modified it slightly on my end removing the database queries and some includes. Since I am running a test file right now on a live server.

 

This is essentially the same logic I included in the file.

http://whmcsaddon.com/myaccount/tria...ate=2011-08-18

 

You may need to change the date variable. This link above is for first warning as of today the 19th.

Sorry I don't quite understand what you are trying to say. Did you modify the file attached to my previous message? The link only shows text. (I'm certainly not a programmer by the way - just enough to be dangerous). What are you suggesting? Thanks

Link to comment
Share on other sites

Sorry I don't quite understand what you are trying to say. Did you modify the file attached to my previous message? The link only shows text. (I'm certainly not a programmer by the way - just enough to be dangerous). What are you suggesting? Thanks

 

Simply the link above just tests out the logic of when to run. It is essentially the same code that you have just removed the sendmessage/suspend/terminate functions and replaced them with text. So that when the date is set for them to execute it will display "Warn 1"/"Warn 2"/"Warn 3"....

 

Changing the date in the URL above will change the sample registration date.

 

Just showing you that the code you have should work.

Link to comment
Share on other sites

Okay thanks. Well, not sure why it's not working on my test server when I run the job manually or via the cron job. The original code works fine, but just continuously sends emails everyday which renders it useless. Ugh, back to the drawing board. Thanks for your help so far.

Link to comment
Share on other sites

  • 3 weeks later...

I finally got this working correctly on my test servers - I like it. What if I did NOT want to actually delete the account from the server after 45 days (or whatever)?

 

It is fine to still send the "terminate" email and go through the motions, but I want to manually delete trial accounts from the server. Anyone know what part to edit? Should I just comment out the &sql and $rs statements below?

 

 if ($regdate == $terminatedays) {
               sendMessage("$terminate",$id); 
               $sql = "insert into tblcancelrequests (date,relid,reason,type) VALUES (now(),".$id.",'Trial Account','Immediate')";
               $rs = mysql_query($sql);

}elseif ($regdate == $suspenddays) {
               sendMessage("$suspend",$id);   
               ServerSuspendAccount($id);

 

Also, does this mod only affect accounts that are "Active" or "Suspended"? Thanks

Link to comment
Share on other sites

Hi Guys,

 

This looks like a great mod. I just wanted to check something about installation. I keep seeing people mentioning a cron job does this mod require that i setup a specific cron job?

 

From what I can tell I just edit the file as I want and upload it but just wanted to be sure.

 

Any help will be much appreciated.

 

Best regards,

 

Vasilis

Link to comment
Share on other sites

I noticed emails weren't sending out recently. And added:

 

$warn1 = $data["warn1"];
$warn2 = $data["warn2"];
$warn3 = $data["warn3"];
$suspend = $data["suspend"];
$terminate = $data["terminate"];

 

Just before this line:

$query = "SELECT tblhosting.id,tblhosting.regdate,tblproducts.servertype FROM tblhosting INNER JOIN tblproducts ON tblproducts.id=tblhosting.packageid WHERE packageid=".(int)$pid."  AND regdate<'$warndays1' AND (domainstatus='Active' OR domainstatus='Suspended')"; 

 

It resolved my issue. Double check that your emails are in fact sending out. And to make it a bit more versatile you can do a check to see if the email is set before sending out an email. For example:

if ($terminate) sendMessage($terminate,$id); 

Link to comment
Share on other sites

  • 3 months later...

I tried the script, perhaps its installed wrong so it doesn't work. But the thoughts of trial abuse come to mind.

 

Even if I can get this to work, how does one prevent users from just getting many free trials over time or by some other way like different domain names or IP addresses they are coming from?

 

Cheers

Link to comment
Share on other sites

  • 3 months later...

Hi we are also finding that the warning emails are being sent every day.ie. the client gets 4 First Notice Trial Ending emails,then on the 5th day they get the second warning - this is then sent every day until the third warning etc....

 

I have been through the posts on this topic and cannot find a solution to this problem. Has anyone got a difinitive answer to what may work.?

 

Apart from this, it seems to be an awesome mod. Thanks in advance.

 

Regards to all.

 

 

 

Hi,

We are finding that the warning emails are being sent every day.ie. the client gets 4 First Notice Trial Ending emails,then on the 5th day they get a a second warning - this is then sent every day until the third warning etc.

 

 

so should

 

 

if ($regdate < $terminatedays) {

sendMessage("$terminate",$id);

$sql = "insert into tblcancelrequests (date,relid,reason,type) VALUES (now(),".$id.",'Trial Account','Immediate')";

$rs = mysql_query($sql);

}elseif ($regdate < $suspenddays) {

sendMessage("$suspend",$id);

ServerSuspendAccount($id);

 

}elseif ($regdate < $warndays3) {

sendMessage("$warn3",$id);

 

}elseif ($regdate < $warndays2) {

sendMessage("$warn2",$id);

 

}elseif ($regdate < $warndays1) {

sendMessage("$warn1",$id);

}

 

be changed to

 

 

if ($regdate = $terminatedays) {

sendMessage("$terminate",$id);

$sql = "insert into tblcancelrequests (date,relid,reason,type) VALUES (now(),".$id.",'Trial Account','Immediate')";

$rs = mysql_query($sql);

}elseif ($regdate = $suspenddays) {

sendMessage("$suspend",$id);

ServerSuspendAccount($id);

 

}elseif ($regdate = $warndays3) {

sendMessage("$warn3",$id);

 

}elseif ($regdate = $warndays2) {

sendMessage("$warn2",$id);

 

}elseif ($regdate = $warndays1) {

sendMessage("$warn1",$id);

}

Link to comment
Share on other sites

  • 1 month later...
  • 9 months later...

What if you just want to remove the 2nd and 3rd warning for one product, but you need to have them for others? Can you just remove the corresponding items in the free trials array without breaking the hook?

 

Yes just delete the lines:

 

elseif ($regdate = $warndays2) {

sendMessage("$warn2",$id);

 

}elseif ($regdate = $warndays1) {

sendMessage("$warn1",$id);

}

 

then set the warn days 3 line in the configuration portion.

Edited by la_rollin
Link to comment
Share on other sites

  • 1 month later...

Hello,

 

does someone is using this addon on latest WHMCS 5.2.x version? There has been changed in latest version what products can be cancelled using cron job and even if cancellation request is being made for free product and this cancellation is being added to cancellation requests list this request is not being processed by cron job and is still visible in cancellation requests list (it doesn't matter if it is Immediate or End of billing period type). If I reported this as a support request I've got response that I should send a feature quests for that so I did:

 

http://requests.whmcs.com/responses/cancellation-requests-from-version-52x-excludes-free-products-quiet-breaking-change-no-info-in-changelog-for-some-of-use-please-re-add-this-possibility

 

Please vote for it because I have totally no idea why this has been changed. Free product is product even if it is free and client should have possibility to cancel it.

 

Regards

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