Version 0.1.0 Updated: 19.02.2019

Installation


The License Manager for WooCommerce, like most WordPress plugins, offers two different setup solutions. The perhaps easiest way would be to use the WordPress Dashboard and install the plugin from the Plugins page, as is intended by WordPress. The other possible solution is to download the entire plugin as a .zip file and use the Plugin page to upload and install. Both are described below

Manual

To manually install the plugin follow these steps

  1. Open the plugin website on wordpress.org
  2. Download the plugin by clicking the Download button located on the top-right side of the screen
  3. Open your WordPress Dashboard
  4. Navigate to PluginsAdd new
  5. On the top of the screen click on Upload plugin
  6. Click on Browse... and select the plugin file you previously downloaded, then click on Install Now
  7. Click on Activate plugin if you wish to activate it immediatelly

WordPress Dashboard

This is the recommended way of installing any WordPress plugin available on the official plugin repository

  1. Open your WordPress Dashboard
  2. Navigate to PluginsAdd new
  3. Search for "License Manager for WooCoomerce" using the search bar located on the top-right side of the screen
  4. In the displayed search results click on Install Now on the License Manager for WooCommerce card
  5. Click on Activate if you wish to activate the plugin immediatelly

Database


During activation, the plugin will create the following database tables:

  1. lmfwc_licenses
  2. lmfwc_generators
  3. lmfwc_api_keys

These tables store the added license keys, license key generators and API keys. All of the tables are required for plugin functionality and both will be prefixed with your defined database prefix.

Table schema

Below you can find the exact database schema for the above mentioned plugin tables.

lmfwc_licenses
Name Data type Length Allow NULL Default
id BIGINT 20 false AUTO_INCREMENT
order_id BIGINT 20 true NULL
product_id BIGINT 20 true NULL
license_key VARCHAR 4000 false
hash VARCHAR 255 false
created_at DATETIME false
expires_at DATETIME true NULL
valid_for INT 32 true NULL
source VARCHAR 255 false
status TINYINT 1 false
lmfwc_generators
Name Data type Length Allow NULL Default
id BIGINT 20 false AUTO_INCREMENT
name VARCHAR 255 false
charset VARCHAR 255 true NULL
chunks INT 10 false
chunk_length INT 10 false
separator VARCHAR 255 true NULL
prefix VARCHAR 255 true NULL
suffix VARCHAR 255 true NULL
expires_in INT 10 true NULL
lmfwc_api_keys
Name Data type Length Allow NULL Default
id BIGINT 20 false AUTO_INCREMENT
user_id BIGINT 20 false
description VARCHAR 200 true NULL
permissions VARCHAR 10 false
consumer_key CHAR 64 false
consumer_secret CHAR 43 false
nonces LONGTEXT true
truncated_key CHAR 7 false
last_access DATETIME true NULL

Encryption


The plugin stores all generated and imported license keys in an encrypted fashion inside the database. For this purpose the composer package defuse/php-encryption is used. On the first run after installation, the plugin will create two .txt files inside the wp-content/uploads/lmfwc-files folder, defuse.txt and secret.txt. Both of these files are paramount to plugin functionality. Without them, hashing or encrypting/decrypting license keys is impossible.

The file defuse.txt is generated by the defuse/php-encryption package and it contains a string representing the cryptographic secret needed to decrypt your license keys, which happens all the time. Since the license keys are encrypted in the database, every time you see a license key string it had to be decrypted first.

The file secret.txt is the secret key used for generating the hash. The file itself is generated using the openssl_random_pseudo_bytes() function with a 32-bit length. This is then converted into a hexadecimal value using bin2hex() and stored inside the file. The hashes are created using the PHP function hash_hmac() and the sha256 algorithm. These hashes are mostly used to compare license keys using SQL statements.

Pages


The plugin will automatically create a total of three pages inside the WordPress Dashboard. These pages are then used to configure the plugin and access its features.

Licenses table

This page allows you to create, edit, and add licenses keys. License keys which have been bought are linked to the order they were bought with. The WooCommerce Order ID is then displayed in the Order column. The corresponding product to which the license key belongs will also be shown inside the Product column. Licenses keys which are not yet assigned to any product will not have a product ID and can not be bought.

If a license key with a set validation date has been bought, then the column Expires at will show the expiry date of the license. The expiry date is calculated based on the Valid for value (validity in days) when the order is bought. For example: If a license key is valid for 10 days after purchase and has been bought on the 10th of May, then it will expire on the 20th of May.

The Source column tells you if the license has been added manually or if it has been generated by the plugin.

The Status column can have one of the following values: Sold, Delivered, Active, and Inactive.

  • Sold License keys have been purchased by a customer and the order is set to "complete". However, the license keys have not yet been delivered.
  • Delivered License keys are those which have been sold and then delivered to the customer. Currently this status is only set if you have automatic delivery enabled inside the plugin settings.
  • Active License keys are available for purchase and will be sent out if they have been assigned to a product, and if that product has been designated to sell license keys.
  • Inactive License keys are not available for sale and will not be sent out to customers.
  • Used License keys can be set to ".

The license bulk actions are located on the top-left side of the page. Via the dropdown menu you can activate, deactivate, and delete license keys in bulk.

The Add new button is located above the bulk actions, right next to the heading. Clicking this button will redirect you to a new page where you can add license keys manually, or in bulk by uploading a .txt or .csv file.

The screen options on the top-right corner of the screen allow you to change the number of licenses keys the table shows per page. This setting is per user.

Actions

There are a couple of actions available when hovering your mouse over a specific license key.

  • Edit License keys can also be edited on by hovering the mouse and clicking the Edit link. Please note that only active and inactive license keys can be edited. Sold, delivered, or used license keys are not editable.
  • Show If a license key is obscured or has been previously hidden, it can be shown again using this action.
  • Hide Obscures the license key.
  • Activate Ready the license key for sale by activating it.
  • Deactivate Deactivated license keys are not sold.
  • Delete Permanently deleted the license key.
Edit license keys

When clicking the Edit action, you will be redirected to a new page where you can edit your license key details..