We just raised $735,000 to introduce the world to multi-tenant WordPress.

Licensing Admin Menu Editor

When creating your product, you’ll quickly find that you might not want your customers to perform certain actions in WordPress. You might have some plugins that need to remain activated, or should not be activated without the customer paying for the additional functionality. In order to limit your customer’s rights, you can use WordPress’ role system.

A great plugin to manage the role system is Admin Menu Editor Pro. It is, however, a paid plugin, meaning you’ll have to activate its license on every new domain you want to use it on. The plugin does allow you to license itself via the Admin panel in WordPress, but this is not a feasible endeavour if you’re using WPCS to automate your customers’ websites.

So, let’s automate the licensing of the Admin Menu Editor plugin using Tenant Lifecycle Hooks!

Requirements

  1. The Admin Menu Editor Pro plugin should be installed and activated in the Version you are working in.
  2. To utilize the Tenant Lifecycle Hooks, we’ll use the Code Snippets plugin. So make sure you install that as well.
  3. In order to license the Admin Menu Editor Pro plugin, you’ll of course need a license for it. Check out Admin Menu Editor Pro to see how to obtain one.

Adding the PHP snippet

Now, with all required plugins snugly installed and activated, stay in the Version and add a PHP snippet with the following code, filling in your license key:

add_action('wpcs_tenant_created', 'activate_license_ame_plugin');

function activate_license_ame_plugin()
{
    $licenseManager = $GLOBALS['ameProLicenseManager'];
    $licenseManager->licenseThisSite('YOUR_LICENSE_KEY');
}
NOTE 1

Make sure you select Run snippet everywhere in the snippet screen!

NOTE 2

Due to the PHP snippets plugin storing snippets in the database, updating the snippets and redeploying will only affect newly created tenants. If you need older tenants to also be updated, you should run these snippets from either a custom plugin or from your theme’s functions.php file.

Testing the hook

When you now create a new tenant based on the Snapshot you’ve just deployed, you should find the Admin Menu Editor is licensed and ready to go!

Related articles

Migrate to WPCS with WPCS Migration Plugin

You can get your sites up and running on the WPCS platform using our free WordPress Migration plugin

Build a Shopify SaaS Clone using WordPress, WooCommerce, WPCS & Kubernetes

Build a WPCS Product in 5 Steps

Build a scalable WordPress SaaS or WaaS (Website as a Service

How to automate your Website as a Service (WaaS) - Storefront included!

How to automate the sale and launch of your websites using a storefront with the WPCS API, WooCommerce, and Uncanny Automator.

Webinar: Merge Sites, Automate, and the Versioning System

Merging your agency’s website portfolio in WPCS where each website has a different tech stack, automate your business with a storefront, and continuously develop your sites like a SaaS.

Getting started with the WPCS Intro Series

Launch your WordPress SaaS in 5 easy steps

Plugin name

Author

WPCS

Description

Let’s automate the licensing of the Admin Menu Editor plugin using Tenant Lifecycle Hooks!

Code Snippet