Addon licensed

From Sohowiki
Revision as of 12:14, 18 September 2008 by Viastep (Talk | contribs)
(diff) ←Older revision | view current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search
Syntax
addon_licensed(addon_folder_name)


What it does
Checks whether domain is licensed to use specified addon (identified by name addon folder)
Returns true/false based on whether addon is/is not licensed
Description
The purpose of this function is to provide a way for premium addon developers to build license checking into their addon. For plugins, it's not incredibly important that you include a call to this function, because it is called by Pro Edition when plugin is initially installed (will not allow install to proceed if license check fails), but you're still welcome to use it as a double-check/extra layer of anti-piracy. For premium templates however there is no built-in license checking at install time, so it's highly advised that you place a call to this function somewhere in one of your template includes (even if that means creating a template include specifically for the license check).
Scope
This function is defined in shared_functions.php, you can call it from anywhere.


Example 1 - Calling addon_licensed() for template You can stick this code in any php file included with your template (i.e. includethis.php, pgm-auto_menu.php, license_check.php -- wherever).

if ( !addon_licensed("SPORTS-Snowboarder-blue") ) {
   echo "This template is not licensed!"; exit;
}

Example 2 - Calling addon_licensed() for a plugin

if ( !addon_licensed("QUICKEDIT_DROPDOWN") ) {
   echo "This plugin is not licensed!"; exit;
}


Note to plugin developers

Many of you may already be familiar with using addon_licensed() function to ensure that your templates cannot be used unless they are properly licensed by the user.

I want to make sure you all know that this function works equally well for ensuring that your plugins are licensed.

The difference is where you place the license check in your code.

With a template, you can put the license check in any of your included php files (e.g., pgm-auto_menu.php, includethis.inc, etc.) --- doesn't really matter where. The reason for this is that all php files included with a custom template are loaded when the template is loaded, and the template is loaded every time a visitor hits a page on the end website. If the template license check fails (bombs), it bombs the whole site.

With a plugin however, placement of the license check matters, because you're determining which part(s) of your plugin will fail to operate normally if the license check fails.

If you only place the license check in the management module of your plugin and not in one of the client-side elements, and the license is cancelled (e.g., due to refund), then the client-side elements will continue to function...the user just won't be able to access you plugin management module.

Personal tools