Jump to content

License Key Manager Addon - Part 1


RPS

Recommended Posts

- I have an api file and a modified actionhooks.php file that will connect to the db and grab the license file, then apply the license file to the client's account.

 

 

Thanks for sharing your module. I've tried it after realizing that the Licensing Addon Module won't meet my requirement since it is only for PHP or bwe application.

 

Could you also please share the remainder of your code?

 

Also, do you think it is possible to display the registration key under Portal Home > Client Area > My Products & Services?

Link to comment
Share on other sites

  • Replies 82
  • Created
  • Last Reply

Top Posters In This Topic

Can I ask as to where i put this code as i'm lossed?

 

Any help would be welcomed

 

David

- Start with the first post here, follow the directions, and when you are not sure of a specific step, please list it. This was created for an older version of WHMCS, so I'm not sure if it still works the same way or not.

 

But i had to change the following for it to work.

 

require('../../../../configuration.php');

 

to

 

require('../../../configuration.php');

- Thanks for pointing that out, something may have changed with the new version of WHMCS, causing this change. If others can confirm this, then I'll update my 1st post.

 

Thanks for sharing your module. I've tried it after realizing that the Licensing Addon Module won't meet my requirement since it is only for PHP or bwe application.

 

Could you also please share the remainder of your code?

 

Also, do you think it is possible to display the registration key under Portal Home > Client Area > My Products & Services?

- The 1st part of the code is in the 1st post, this is just a backend area to handle the administration side of things.

 

The 2nd part, is in the 8th post: http://forum.whmcs.com/showpost.php?p=49196&postcount=8

 

This is the actionhooks part that actually adds the license key to the order process, sends out the correct e-mails, etc.. I haven't updated it to work with the newer versions of WHMCS, so I'm not sure if it still works or not.

Link to comment
Share on other sites

I've done as said and have put the code below into the ACTIONHOOKS.php file with no luck so I don't know i've done it right or wrong?

 

// location for WHMCS configuration file
require('../../configuration.php');


$key = $_GET['key'];
$company = $_GET['company'];
$product = $_GET['product'];
$type = $_GET['type'];

// http://www.your-domain.com/order.php?key=00000&company=AVG&product=AntiVirus&type=OEM
if($key == "0000")
{
   mysql_connect($db_host, $db_username, $db_password) or die(mysql_error());
   mysql_select_db($db_name) or die(mysql_error());

   # Let's grab the ID and License Key for the first license that is available
   $result = mysql_query("SELECT `id`,`key` FROM mod_license_keys WHERE avail='1' AND company='".$company."' AND product='".$product."' AND type='".$type."' LIMIT 1");

   $grab_fieldname = mysql_fetch_row($result);
   $id = $grab_fieldname[0];
   $licensekey = $grab_fieldname[1];

   // License is sold out, send error message
   if(!$licensekey){
       echo "SOLD OUT";}
   else{
       // output the id (location) and serial number
       echo "SUCCESS,".$id.",".$licensekey;}

   // set serial number to be no longer available
   mysql_query("UPDATE mod_license_keys SET avail='0' WHERE id='".$id."'");
} 

Link to comment
Share on other sites

This is the actionhooks part that actually adds the license key to the order process, sends out the correct e-mails, etc.. I haven't updated it to work with the newer versions of WHMCS, so I'm not sure if it still works or not.

 

Thanks for the pointer, btw, your pm box is full.

 

Would you also share which hook point are you using?

http://wiki.whmcs.com/Action_Hooks

 

My requirement is a little tricky because some users (big corporations) are on net 30 and require the license key on order, while others should get it only after payment.

 

Also, do you intend to show the license key when the user login to view the service/product?

 

 

I've done as said and have put the code below into the ACTIONHOOKS.php file with no luck so I don't know i've done it right or wrong?

 

 

Is there an actionhooks.php?

 

It says here that to create an action hook we need to declare a function that performs the action we want to run, and then add the hook to WHMCS by calling the add_hook function, e.g.

 

function create_forum_account($vars) {
   print_r($vars);
}
add_hook("ClientAdd",1,"create_forum_account");

http://wiki.whmcs.com/Action_Hooks

Link to comment
Share on other sites

My requirement is a little tricky because some users (big corporations) are on net 30 and require the license key on order, while others should get it only after payment.

 

So ideally, I should use a hook that runs only after the order has been accepted by me.

Edited by clickndeploy
Link to comment
Share on other sites

  • 2 weeks later...

Im working on one, just need to get the makers permssion. I have also added another option to it.

 

You will be able to assign a license to a User, and you will be able to delete the licenses.

 

But that is whats coming up. Im also working on a "server" module for it, so that you can sell them from the database, and get that automatically assigned to a user.

 

List of New Features

  • Assign License to User
  • Delete Licenses
  • Sell licenses and assign them to customers
  • Add License types (Monthly, Yearly, Owned, + You can add your own)
  • Username Field (Needed to assign to a user)
  • Notifies Admin to suspend license when customer hasnt paid (Email)

 

So thats it so far, any more suggestions feel free to say so. I will post an Image soon of what it looks like now.

Link to comment
Share on other sites

Ok, I have been working on and Improving It, I will release if I get the authors permission.

 

Here is some new features that I have added

 

- Username Field

- New license types (Monthly, Yearly, Owned)

- Notify admin to via email to suspend their license at Script Providers (When their license is set un-paid)

- Added to the admin menu

 

Features to be added

- "Server" Module (So you can sell the licenses and assign it to a user automatically)

- Change + Add Licnense types in Script (not PHP changes, or Manual MySQL)

- Edit License + Delete License

 

If anyone wants to help me, send me a PM, and If you have any suggestions, send me a PM.

Link to comment
Share on other sites

  • 2 weeks later...
Ok, I have been working on and Improving It, I will release if I get the authors permission.

 

Here is some new features that I have added

 

- Username Field

- New license types (Monthly, Yearly, Owned)

- Notify admin to via email to suspend their license at Script Providers (When their license is set un-paid)

- Added to the admin menu

 

Features to be added

- "Server" Module (So you can sell the licenses and assign it to a user automatically)

- Change + Add Licnense types in Script (not PHP changes, or Manual MySQL)

- Edit License + Delete License

 

If anyone wants to help me, send me a PM, and If you have any suggestions, send me a PM.

 

interesting, have you considered on how to let the user view their assigned license online?

 

:D

Link to comment
Share on other sites

  • 2 weeks later...
Has anyone tried WHMCS' Licensing add-on?

 

http://whmcs.com/licensingaddon.php

 

Yes it pretty much sucks, support lacks and not enough info to help make it work, I have to say I am not a master head php coder but know enough to get around, and with backup php coding support it is far from the best option.

 

Lacks the info to properly integrate into a file and suspend and expire etc, in other words if you suspend the license the script you made still works but the debugger shows it suspended and only shows suspended without the localkey inserted does that make since? Not by far so I would not recommend this to a beginner unless you have phat pockets.

Link to comment
Share on other sites

Yes it pretty much sucks, support lacks and not enough info to help make it work, I have to say I am not a master head php coder but know enough to get around, and with backup php coding support it is far from the best option.

 

Lacks the info to properly integrate into a file and suspend and expire etc, in other words if you suspend the license the script you made still works but the debugger shows it suspended and only shows suspended without the localkey inserted does that make since? Not by far so I would not recommend this to a beginner unless you have phat pockets.

 

Have you tried suggesting any of the features you think is lacking to WHMCS? I ask because I'm curious if this module is done with development or whether they continue to make it better.

Link to comment
Share on other sites

  • 2 months later...
I need to get permission first. :)

 

 

Any updates?

 

I would think you could do your mod as long as you ref back to the op's site/this thread like:

 

put this in the footer of the admin and top of each changed file:

1, Portions Copyright © "date of op's last post here" op's name and link to this thread.

2, "the name of your mod" is derived from: Copyright © "date of op's last post here" op's name and link to this thread

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