Jump to content
mfoland

WHMCS Like Auto Upgrade Page

Recommended Posts

Hello, 

I got to thinking.. For the license module, if you have different license tiers, and want to offer auto upgrades.. Could you make a page like this: https://www.whmcs.com/members/autoupgrade.php 

With using bootstrap like that.. I know it's possible, but does this somehow manage a custom field within WHMCS? I've always thought about that! I'd love to know your thoughts, as I'd love to build something like it!

Share this post


Link to post
Share on other sites
Posted (edited)

If I understood you correctly, of course it's doable. You can retreive the data you need from LicensingAddonVerify hook point. Obviously your software should be changed accordingly so that it returns the number of active clients on which you can base your logic. Once you have data you can upgrade/downgrade the license of your software on a daily basis with DailyCronJob.

As for the opt-in opt-out for auto-upgrades it's just an extra page with a toggle (aka checkbox) that should to be added somewhere on your website. Before upgrading any license first you need to check if this checkbox is true or false. When true the auto-augrade can run otherwise, still using  LicensingAddonVerify, you return an extra variable like follows:

<?php

add_hook('LicensingAddonVerify', 1, function($vars) {
    return [
        'UpgradeNotPossibleBecauseOfOptOut' => true,
    ];
});

Based on $UpgradeNotPossibleBecauseOfOptOut you can make extra stuff on your softare like for example displaying an alert that says "Hey! Opt-In Auto-Upgrade otherwise I kill you", turn off some features, delete database etc.

Edited by Kian

Share this post


Link to post
Share on other sites

@Kian I would love to make that slider and actually integrate it into my WHMCS and for those that have the slider as enabled, then it would allow automatic upgrades for a license call 🙂 I might even do that for like auto product upgrades.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • By mfoland
      Hello,
       
      I made a Square Gateway, which is in the Marketplace. The issue right now, is it's coded with PHP, and has to rely on allowing it to run with the php smarty tags, which aren't recommended. Is there an alternative way to avoid Smarty PHP tags?
       
      Thanks!
    • By mfoland
      So I'm working with the licensing addon, and attempting to figure out the hook part..
       
      add_hook('LicensingAddonVerify', 1, function($vars) { return [ 'Hash' => 'Hash Here', ]; } ); The hash actually shows in the license how it should, but I'm trying to do it since I make several softwares, and not only one, so what I'm trying to do is something like
      if ($productid == "prodID number") { add_hook('LicensingAddonVerify', 1, function($vars) { return [ 'Hash' => 'Hash Here', ]; } ); } else -- run get different product It doesn't retrieve the product id at all.. What am I missing here? The hash is basically there to tell the system if a new version has been released. 
       
      Thanks
    • By Screamfox
      I found a old pretty cool script and i would like to perform him because like as been reported before the hook put the admin area with infinite loops
       
      <?php add_hook('ClientAreaPage', 1, switch_language($vars)); function switch_language($vars) { $country_to_language = array( 'default' => 'english', 'AR' => 'arabic', 'AR-DZ' => 'arabic', 'AR-BH' => 'arabic', 'AR-EG' => 'arabic', 'AR-IQ' => 'arabic', 'AR-JO' => 'arabic', 'AR-KW' => 'arabic', 'AR-LB' => 'arabic', 'AR-LY' => 'arabic', 'AR-MA' => 'arabic', 'AR-OM' => 'arabic', 'AR-QA' => 'arabic', 'AR-SA' => 'arabic', 'AR-SY' => 'arabic', 'AR-TN' => 'arabic', 'AR-AE' => 'arabic', 'AR-YE' => 'arabic', 'AZ' => 'azerbaijani', 'CA' => 'catalan', 'ZH' => 'chinese', 'ZH-HK' => 'chinese', 'ZH-CN' => 'chinese', 'ZH-SG' => 'chinese', 'ZH-TW' => 'chinese', 'HR' => 'croatian', 'CS' => 'czech', 'DA' => 'danish', 'NL' => 'dutch', 'NL-BE' => 'dutch', 'EN' => 'english', 'EN-AU' => 'english', 'EN-BZ' => 'english', 'EN-CA' => 'english', 'EN-IE' => 'english', 'EN-JM' => 'english', 'EN-NZ' => 'english', 'EN-PH' => 'english', 'EN-ZA' => 'english', 'EN-TT' => 'english', 'EN-GB' => 'english', 'EN-US' => 'english', 'EN-ZW' => 'english', 'ET' => 'estonian', 'FA' => 'farsi', 'FR' => 'french', 'FR-BE' => 'french', 'FR-CA' => 'french', 'FR-FR' => 'french', 'FR-LU' => 'french', 'FR-MC' => 'french', 'FR-CH' => 'french', 'DE' => 'german', 'DE-AT' => 'german', 'DE-DE' => 'german', 'DE-LI' => 'german', 'DE-LU' => 'german', 'DE-CH' => 'german', 'HE' => 'hebrew', 'HU' => 'hungarian', 'IT' => 'italian', 'IT-CH' => 'italian', 'MK' => 'macedonian', 'NO' => 'norwegian', 'NB' => 'norwegian', 'NN' => 'norwegian', 'PT-BR' => 'portuguese-br', 'PT' => 'portuguese-pt', 'RO' => 'romanian', 'RO-MO' => 'romanian', 'RU' => 'russian', 'RU-MO' => 'russian', 'ES' => 'spanish', 'ES-AR' => 'spanish', 'ES-BO' => 'spanish', 'ES-CL' => 'spanish', 'ES-CO' => 'spanish', 'ES-CR' => 'spanish', 'ES-DO' => 'spanish', 'ES-EC' => 'spanish', 'ES-SV' => 'spanish', 'ES-GT' => 'spanish', 'ES-HN' => 'spanish', 'ES-MX' => 'spanish', 'ES-NI' => 'spanish', 'ES-PA' => 'spanish', 'ES-PY' => 'spanish', 'ES-PE' => 'spanish', 'ES-PR' => 'spanish', 'ES-ES' => 'spanish', 'ES-UY' => 'spanish', 'ES-VE' => 'spanish', 'SV' => 'swedish', 'SV-FI' => 'swedish', 'SV-SV' => 'swedish', 'TR' => 'turkish', 'UK' => 'ukranian', // NOTE: You can add more below ); if(!isset($_SESSION['switch-language']) && $_SESSION['uid'] == false) { $_SESSION['switch-language'] = true; // prevent from redirecting back again in this session } $current_country = strtoupper(substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2)); $language = $current_country != '' && isset($country_to_language[$current_country]) ? $country_to_language[$current_country] : $country_to_language['default']; if(!isset($_SESSION['Language']) || $_SESSION['Language'] != $language) { $location = '?language='.$language; if($_SERVER['QUERY_STRING'] != '') $location .= '&'.$_SERVER['QUERY_STRING']; ob_clean(); header('location: '.$location); die(); } } ?> some one have one idea to do a work arround, he give so many loops on admin area like this
       
      administator/?language=portuguese-pt&language=portuguese-pt&language=portuguese-pt&amp;lang...  
      so there is any suggestion to fix this old good script he works great for client area but no for admin area ☹️
      credits for, 
      @webix
      @Remitur
      @brian!
    • By wp4all
      Hi @ all,
      got some problems with modifying the configuredomains.tpl
      This is what I have at the moment :

      This is what I would like to have :

       
      That's the part that drives me to despair :
      {foreach key=domainfieldname item=domainfield from=$domain.fields} <div class="form-group"> <label class="{$responsio.classes.col}-3 {$responsio.classes.label} control-label">{$domainfieldname}</label> <div class="{$responsio.classes.col}-8"> {if $domainfield.type == "tickbox"}<div class="checkbox {$responsio.classes.checkbox}">{$domainfield}</div>{else}{$domainfield|replace:"type=\"text\"":"type=\"text\" class=\"form-control `$responsio.classes.input`\""|replace:"type=\"password\"":"type=\"password\" class=\"form-control `$responsio.classes.input`\""|replace:"<select":"<select class=\"form-control `$responsio.classes.input`\""|replace:"<textarea":"<textarea class=\"form-control `$responsio.classes.input`\""|replace:"style=\"width:90%;\"":""}{/if} </div> </div>{/foreach} Maybe someone has an idea how I could solve it .
      Thanks and best regards
      Christian
    • By robetus
      I found an older post regarding this but I wanted to post a working hook that adds recaptcha to the checkout page. I think this a great thing especially if you're being bombarded with fake accounts and orders.
      /includes/hooks/checkout-recaptcha.php:
      <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); function limitOrders($vars) { $url = 'https://www.google.com/recaptcha/api/siteverify'; $privatekey = "YOUR_RECAPTCHA_SECRET_KEY_HERE"; $response = file_get_contents($url . "?secret=" . $privatekey . "&response=" . $_POST['g-recaptcha-response'] . "&remoteip=" . $_SERVER['REMOTE_ADDR']); $data = json_decode($response); if (isset($data->success) AND $data->success == true) { // everything is ok! } else { $pm = $vars['paymentmethod']; if ($pm == "paypalpaymentspro") { global $errormessage; $errormessage.= "<li> Please, confirm that you are not a robot! <br/></li>"; } //if CC } } //function add_hook("ShoppingCartValidateCheckout", 1, "limitOrders"); Change YOUR_RECAPTCHA_SECRET_KEY_HERE to your the recaptcha private/secret key Google gives you. I'm using for my credit card checkout which is "paypalpaymentspro" but you can use it for any payment method. I think you really only need if you accept credits though. To get your payment method view source on the checkout page and search for "paymentmethod" your payment method will be near this.
      In your checkout.tpl file you also need to add somewhere under the "Complete Payment" button:
      <div class="g-recaptcha" data-sitekey="YOUR_RECAPTCHA_PUBLIC_KEY_HERE"></div> Replace YOUR_RECAPTCHA_PUBLIC_KEY_HERE with your public recaptcha key provided by Google.
      This is tested working on WHMCS v7.5.1.
  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

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