Hi there!
I've modified my WHMCS to allow product scaling through a credit system. I like it but, I want to disable upgrade/downgrades for 7 days before allowing it again.
This is my plan, I need a little help with the hook though.
After a product upgrade (or downgrade) this hook performs. But.. it does not work, what's wrong with it?
<?php
add_hook('AfterProductUpgrade', 1, function($vars) {
$userid = $vars['userid'];
$command = "updateclientproduct";
$adminuser = "admin";
$values["clientid"] = $vars["userid"];
$values["description"] = "Updating Last Upgrade Date via ClientAreaUpgrade hook";
$values = array('serviceid' => $params["serviceid"], 'customfields' => base64_encode(serialize(array('Last Upgrade' => echo date('d/m/Y'))));
$results = localAPI($command,$values,$adminuser);
return array();
}
);
I'm hoping to add the system date to their product custom field ("Last Upgrade") when upgrading.
Then in the clientarea product details .tpl I can check If the current system date is over 7 days from the saved system date from the custom field.
Furthermore showing or not, the upgrade/downgrade buttons.
Simple? Thanks!