Jump to content
Sign in to follow this  
Kian

Auto-Terminate Free Trials After X Minutes

Recommended Posts

Free trials for a limited period is a good marketing strategy to capitalize on the leads you get. The problem with trials is that the smallest unit of time for WHMCS is the day meaning that for example you can't provide a trial for VPS that last for a couple of hours. WHMCS can't "think" for a period of less than a full day.

The following action hook allows to automatically terminate the given products/services after a certain number of minutes. It runs AfterCronJob hook point that normally triggers once every 5 minutes. Visit Setup > Automation Settings and make sure that cron.php runs every 5 minutes as suggested by WHMCS. The hook will do the rest. It also logs terminations in Activity Log.

Get the Code »

Share this post


Link to post
Share on other sites

The script has been updated with two new features.

First. You can perform Termination or Suspension.

Second. The previous version of the hook worked only for products/services using a server module (eg. Plesk, cPanel etc.). Now it works also with "basic" services not assigned to any server module. In other words services with no Create, Suspend, Unuspend and Terminate button. In this case the script updates the status accordigly.

I'm also planning to make the hook work with multiple conditions like in the following example:

  • Product ID 10 suspended after 10 minutes
  • Product ID 12, 13 and 14 suspended after 8 hours
Edited by Kian

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Similar Content

    • By dsaunier
      Hi,
      I'd like to check who would have the same context as me and if there is a better way to configure my WHMCS for this :
      Several of our clients have an automated renewal option chosen by credit card or bank transfer (initiated by us ie SEPA) so they have nothing to do to keep the services.
      Those payments are processed in the last day of the month though, and some domains expire at the registrar before that, hence if we do nothing the domain can be expired/suspended before the automated payment confirming the renewal is processed and therefore automatically renews the name at the registrar.
      Right now we just suspend the registrar API with the domain, renew it manually so it continues working, and once the payment arrives we reconnect the registrar API so that the name is not renewed once more for free.
      Any better way to do that ?
      Thanks for your attention.
    • By ModulesGarden
      1. DirectAdmin Extended For WHMCS 3.9.0

      One of the foundations of our company, and the reason why our products are so highly praised, is the fact that customer feedback is so deeply important to us.

      Having received your priceless suggestions, our team immediately started to consider how the desired functionalities could be implemented into DirectAdmin Extended For WHMCS. So what’s the result of days of their hard work? The 3.9.0 milestone!

      This latest version introduces a handful of spanking-new features, which allow your customers to perform even more actions in a fully remote manner. They are now empowered to:
      Manage DNS records of domain pointers. Paste their Certificate Authority root SSL certificate. Restore default DNS record configuration. Let the changelog take it from here to astonish you with the full extent of this grand update, available at a great 10% discount!

      Read more about DirectAdmin Extended For WHMCS 3.9.0!




      2. Choose the perfect automation tool with EasyDCIM Blog!

      Automation is a solution that can substantially improve the functioning of a web hosting business in many aspects – not only does it leave extra time for crucial and complicated tasks, but it also shrinks costs and saves more money as a direct result.

      In order to get the most of these pros, what a prosperous business needs is a proper automation tool. Some of the ones available on today’s market may be too pricey, others lack crucial functionalities. In that case, how should you find what you’re looking for without hours of research?

      The answer is brought to you by EasyDCIM! Their latest Blog post meticulously describes four most common picks by small and mid-sized companies, with that exclusive list being crowned by none other than WHMCS!
      If you’ve been wondering about differences between these solutions or are new to the subject and want to learn how to streamline your business processes, follow your instincts and access EasyDCIM Blog as quickly as possible!

      Read more about dedicated server automation!




      Need Custom Software Development For Your Business?
      Get Your Free Quote Now! Specially for you we will adapt an application and its design to your own needs, create a new module or even a completely new system built from scratch!
    • By ModulesGarden
      1. Discover what our modules are up to!

      You can already view all previously uploaded advances and improvements at any time in our marketplace. What if you could also see what the next stages of development hide? This has just been made possible with the all-new section placed right next to the changelog.

      The implementation of Roadmap will show you that caring for customer engagement is one of the most important aspects taken into consideration at ModulesGarden. Want to know more and give the new feature a go?

      Continue reading on the ModulesGarden Blog!




      2. Zendesk For WHMCS 2.4.0

      You already know that we have a module in our offer that lets you include support tools powered by Zendesk into WHMCS and handle support tickets while bringing your clients unforgettable experience of customer care. Guess what - it’s just been updated with some fresh solutions!

      The description of the 2.4.0 update of Zendesk For WHMCS should start off with WHMCS users support - an addition which will send email notifications about the in-flow of new ticket replies to any user that participates in a conversation. Excited? Let us make you even more eager to give it a look. The latest version makes WHMCS user details fully synchronized with the Zendesk panel!

      See for yourself how easily you can up your customer service at an amazing 15% discount - give the changelog a thorough read!

      Read more about Zendesk For WHMCS 2.4.0!




      3. Password Manager For WHMCS 3.0 - 25% OFF

      In the business landscape of today’s world, cyber security is a top priority. Safe and long passwords are a great start, however remembering complex keystroke combinations can be too much of a challenge sometimes.

      The answer to these concerns is here - Password Manager For WHMCS 3.0! The latest huge update introduces an overhauled user interface with a brand new look, as well as support for Lagom Client Theme and WHMCS "Twenty-One".

      This fabulous module for extended safety has already been flooded with positive reviews, so delve deeper into the subject and find out how we have elevated it to new heights!

      Read more about Password Manager For WHMCS 3.0!




      4. PanelAlpha sets new trends in WordPress automation!

      Let us remind you of one more grand advancement - the next level in the development of our top-notch system for WordPress instances provisioning, PanelAlpha!

      The addition of Personal Hosting Toolkit will provide your clients with swift and painless control over their accounts by empowering them to handle domains, FTP accounts, DNS zones and more, all from the level of PanelAlpha.

      We all know how crucial a unique brand is nowadays. That’s why you will be able to customize the client area to fit yours however you desire with the Style Manager! Switch colors, enable shadows - from now on, you will be able to let out the inner artist.

      In fact, you can experience it right away via live demo, accessible at all times!

      Put theory into practice and see PanelAlpha in powerful action!




      Need Custom Software Development For Your Business?
      Get Your Free Quote Now! Specially for you we will adapt an application and its design to your own needs, create a new module or even a completely new system built from scratch!
    • By kwood
      Hi,
      I have created a separate folder for my cron jobs, following the WHMCS user guide for security, which it stated in the System Health Check area.
      It all changed fine, and the crons are running from the new folder, but when I go to enter the System Health Check area I get the following:
       
      League\Flysystem\Exception: Impossible to create the root directory "........./dashboard/cron_jobs". mkdir(): Permission denied in ........../dashboard/vendor/league/flysystem/src/Adapter/Local.php:112 Stack trace: #0 ..........dashboard/vendor/league/flysystem/src/Adapter/Local.php(78): League\Flysystem\Adapter\Local->ensureDirectory('p...') #1 ..........dashboard/vendor/whmcs/whmcs-foundation/lib/View/Admin/HealthCheck/ApplicationDirectory.php(0): League\Flysystem\Adapter\Local->__construct('p...') #2 ..........dashboard/vendor/whmcs/whmcs-foundation/lib/View/Admin/HealthCheck/HealthCheckRepository.php(0): WHMCS\View\Admin\HealthCheck\ApplicationDirectory->__construct('p...') #3 ..........dashboard/vendor/whmcs/whmcs-foundation/lib/View/Admin/HealthCheck/HealthCheckRepository.php(0): WHMCS\View\Admin\HealthCheck\HealthCheckRepository->newApplicationDirectory('p...') #4 ..........dashboard/vendor/whmcs/whmcs-foundation/lib/View/Admin/HealthCheck/HealthCheckRepository.php(0): WHMCS\View\Admin\HealthCheck\HealthCheckRepository->customizableDirectories() #5 ..........dashboard/vendor/whmcs/whmcs-foundation/lib/View/Admin/HealthCheck/HealthCheckRepository.php(0): WHMCS\View\Admin\HealthCheck\HealthCheckRepository->checkDirectoryCustomizations() #6 ..........dashboard/admin/systemhealthandupdates.php(0): WHMCS\View\Admin\HealthCheck\HealthCheckRepository->nonKeyChecks() #7 {main} Please, can anyone advise what I need to do?
       
      Many thanks
    • By Rowan S
      Hello,
      Is anybody able to assist with a issue I’m having with my WHMCS licence module. The WHMCS licence module is a module which automatically registers/creates WHMCS licences. 
      The idea is that you could utilise the daily cron hook point to run some additional code to check every WHMCS licence addon’s check the next due date and cancel the license if it’s in the past. 
      I don’t believe that this would be too difficult to code but I am not familiar with this. It would be greatly appreciated if somebody could code this for me. 
      Thanks! 
  • 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