WordPress provides a powerful role system that allows you to control what your customers can and can’t do on your website. However, when you create your product, you might want to limit your customers’ rights to protect certain plugins.
If you’re looking for a convenient solution, Admin Menu Editor Pro is the perfect plugin to manage the role system. This premium plugin provides you with the ability to control the WordPress administration menu and restrict access to certain areas. The only drawback is that it requires a license activation on every new domain you use it on.
Fortunately, you can automate the licensing of the Admin Menu Editor plugin using Tenant Lifecycle Hooks. This guide will show you how to activate the license with ease using PHP snippets.
Requirements:
- Admin Menu Editor Pro plugin must be installed and activated.
- Code Snippets plugin must be installed and activated.
- A valid license for Admin Menu Editor Pro.
Step 1: Add the PHP Snippet
phpCopy code
add_action('wpcs_tenant_created', 'activate_license_ame_plugin');
function activate_license_ame_plugin()
{
$licenseManager = $GLOBALS['ameProLicenseManager'];
$licenseManager->licenseThisSite('YOUR_LICENSE_KEY');
}
Note:
- Make sure to select “Run snippet everywhere” in the snippet screen.
- To update older tenants, you should run the snippet from either a custom plugin or your theme’s functions.php file.
Step 2: Test the Hook
Now, whenever you create a new tenant, the Admin Menu Editor Pro plugin should be licensed and ready to use. To verify, create a new tenant and check if the plugin is licensed and working correctly.
With these simple steps, you can easily activate the license for the Admin Menu Editor Pro plugin using Tenant Lifecycle Hooks. Try it today and streamline your WordPress website management process.