Jump to content

Upgrade Hooks


Recommended Posts

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? :P Thanks!

 

Screen Shot 2017-04-21 at 12.43.33 AM.png

Link to comment
Share on other sites

  • 2 weeks later...

Woah! Credit system? I wanna check this out!! Are you going to opensource it or sell it? One of my favorite credit systems in the whole wide world is for WordPress and it's called MyCred - is that what you are coding? Heheh

 

I've searched and searched and only 2 available solutions are both promising but still missing something. That picture you linked looks mad fancy.

Link to comment
Share on other sites

  • 3 weeks later...
Woah! Credit system? I wanna check this out!! Are you going to opensource it or sell it? One of my favorite credit systems in the whole wide world is for WordPress and it's called MyCred - is that what you are coding? Heheh

 

I've searched and searched and only 2 available solutions are both promising but still missing something. That picture you linked looks mad fancy.

 

Oh it is mad fancy!! Have spent over 4 months on it actually haha.

It's based on Digital ocean's system. In a rush but thought i'd throw up some pics (logo's are blurred btw.. then I remembered my username LOL).

 

http://imgur.com/a/L19XV

Link to comment
Share on other sites

Woah! Credit system? I wanna check this out!! Are you going to opensource it or sell it? One of my favorite credit systems in the whole wide world is for WordPress and it's called MyCred - is that what you are coding? Heheh

 

I've searched and searched and only 2 available solutions are both promising but still missing something. That picture you linked looks mad fancy.

 

Oh it is mad fancy!! Have spent over 4 months on it actually haha.

It's based on Digital ocean's system. In a rush but thought i'd throw up some pics (logo is blurred btw).

 

http://imgur.com/a/L19XV

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