WordPoints / wordpoints

Points plugin for WordPress
GNU General Public License v2.0
20 stars 15 forks source link

Show notice when a module license key is invalid #663

Closed JDGrimes closed 7 years ago

JDGrimes commented 7 years ago

Previously: https://github.com/WordPoints/wordpointsorg/issues/5

JDGrimes commented 7 years ago

There are really two parts to this, I guess.

The later was the primary focus of the original ticket, but I have always kind of thought that we should do both, which is likely why I changed the scope when copying this over.

JDGrimes commented 7 years ago

Just realized that when an expired license key is attempted to be activated, the feedback just says that it is invalid. It should probably be saved, since it actually technically is valid, but marked as expired.

JDGrimes commented 7 years ago

Now, a user will see this when activating an expired license:

wordpoints_ _extensions_ _wordpress_develop_ _wordpress_-_2017-06-27_14 56 43

And the key will be saved, and they'll see this in the license row in the table:

wordpoints_ _extensions_ _wordpress_develop_ _wordpress_-_2017-06-27_14 55 29

JDGrimes commented 7 years ago

We probably ought to add a button to recheck the license status. Otherwise, after the user renews the license, I'm not sure that the status will get updated. At least not right away, but maybe not at all (which in itself may be an issue).

JDGrimes commented 7 years ago

We recheck a license's status when an update check fails, however, once a license's status is thought to be invalid/expired, I don't think that we ever do a check that would detect its renewal. We should do something similar as we did in https://github.com/WordPoints/wordpoints/commit/a9bc1293ad78952764db4b0508d19d71b0b6aaeb.

JDGrimes commented 7 years ago

I was wondering whether we need to keep tack of the license statuses in an option or something, or whether we can just pull all of the license info up and check it each time. The latter option may be too expensive an operation (we'd have to call wordpoints_get_modules()), so we might have to go the slightly more complicated route of storing the list of expired/invalid license keys in an option.

JDGrimes commented 7 years ago

On second thought though, I'm not sure that we can display the information that we want to without the module info anyway (extension name, for example). Anyway, we can't get the renewal URL without the extension ID.

The good news is, that we can get the extension info without having to read the files, because extensions can register their headers directly. So I think I'll opt for just running the check each time for now.

JDGrimes commented 7 years ago

Examples:

wordpoints_ _settings_ _wordpress_develop_ _wordpress_-_2017-06-27_20 39 32

JDGrimes commented 7 years ago

And when a license is deactivated:

wordpoints_ _settings_ _wordpress_develop_ _wordpress_-_2017-06-27_20 48 08