Day 66: Plugin License Server

Continuing on the plugin from yesterday, I was able to get the license server working and integrated. It followed the same luck as the update server, though.

The plugin had a couple spots where it checked the license. That really only required I tie in my server at those points instead of the existing one. That did cause a couple of issues, however.

First, the license check returns true or false. For me, the check kept failing and wouldn’t remove the “invalid license, please try again” screen from the plugin admin section. After walking through each line, it seems like the true and false values were reversed.

More than likely, the original plan was to have it return a success status when it actually failed to get around the license server being a premium, monthly subscription product when the plugin was white labeled.

That would allow the code to actually work even though the license check wasn’t. Eventually, it was just commented out so the check would never even happen to begin with. I had to change the values so that a valid license wasn’t saying to enter it again.

Once I got that working, I hit a second issue. The way the premium license server works is it basically just checks the license that was sent. The way mine is set up, it can check the status or activate new licenses.

The problem them occurs when an activated license tries to be activated again. It throws the error that the maximum number of times the license can be used is hit, and it cannot be used again.

I had to go through and make the appropriate changes to active the license only on the initial install and the subsequent calls were to only do a license check.

That is finally working. The more I think about it, though, the more it would make sense to do a check and if it’s not activated, then do the activated call. Worst case, it makes 2 calls.

Otherwise, I might run into a problem where the user has a valid license, but keeps getting a status call instead of an activate call, and it never fully becomes activated. The worst case there is the license always comes back as invalid.

With the update server working, I could just get something ready to go and make updates later. The update server would pull the latest changes to everyone who has a previous version installed. If I launch and get no sales, spending time on the details is pointless.