Jump to content

WHMCS Like Auto Upgrade Page


mfoland

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!

Link to comment
Share on other sites

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
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.

×
×
  • 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