Another feature in Titan Framework is its builtin ability to use Easy Digital Downloads (EDD) to validate a license. This is a great thing for users who wish to sell their plugins and themes and has Easy Digital Downloads as the cart backend.
This feature requires a few things:
- The server must be running Easy Digital Downloads
- The server has a Software Licensing extension. EDD itself is free, but the Software Licensing extension requires purchase.
What’s in it for me?
This can be used to bring autoupdates, notify of updates, or to an extent, enable or restrict features depending on license validity. Some extra coding as per EDD Software Licensing may be needed.
Please take note though that WordPress.org has certain rules on themes and plugins, including what can and cannot be restricted. These includes embedding codes of whole plugins and frameworks like Titan Framework, which is discouraged. To know them all, read up here for plugins and for themes.
How does it work?
It’s as simple as adding this line of code.
'name' => 'EDD License Option',
'id' => 'my_license',
'type' => 'edd-license',
'desc' => 'Please enter your license key to receive updates',
'server' => esc_url( 'http://mycoolsite.com' ),
'file' => __FILE__, // Assuming this was called inside your main plugin script
'item_name' => 'My Product',
Titan Framework itself will check for the code’s validity and will not commit the license data if found to be invalid.
From there, you can check the value of the id through getOption and use it as basis for enabling or disabling certain elements in your plugin or theme.