BuycPanel Blog

BuycPanel Blog

Latest news and updates

How to Create a WHM Plugin?

Posted by Allura on 24 01 2019.

Introduction
WHM plugins work in adding the system administrator level functionality to cPanel and WHM users. This tutorial is applicable only for cPanel and WHM version 66 and later.Create a WHM Plugin
One can create one’s own plugin’s backend code. In that case one can use the preferred programming language to write one’s own plugin’s backend code.One must add appropriate Access Control List (ACL) checks, if the plugin’s functionality requires specific permissions.Create your Plugin’s Interface
Provide one or more interfaces in order to allow WHM users to access your plugin within the WHM interface.One can read our Guide to WHM Plugins – Interfaces documentation to gather more information.One can also read our Create a New WHM Interface in Template Toolkit and Create a New WHM Interface in PHP tutorials to get an idea about the steps in creating a basic WHM interface.Add an Installation Script
One can include an installation script with the help…

Introduction

WHM plugins work in adding the system administrator level functionality to cPanel and WHM users. This tutorial is applicable only for cPanel and WHM version 66 and later.

Create a WHM Plugin

One can create one’s own plugin’s backend code. In that case one can use the preferred programming language to write one’s own plugin’s backend code.

One must add appropriate Access Control List (ACL) checks, if the plugin’s functionality requires specific permissions.

Create your Plugin’s Interface

Provide one or more interfaces in order to allow WHM users to access your plugin within the WHM interface.

One can read our Guide to WHM Plugins – Interfaces documentation to gather more information.

One can also read our Create a New WHM Interface in Template Toolkit and Create a New WHM Interface in PHP tutorials to get an idea about the steps in creating a basic WHM interface.

Add an Installation Script

One can include an installation script with the help of these WHM plugins.

To add an installation script, these actions are to be performed:

  • Check for the appropriate installation directories and create any of which that does not exist already.
  • The plugin must be registered with the AppConfig system.
  • One needs to copy the plugin files, templates, and icons into the appropriate locations.

Note that AppConfig registration does not  search for or run installation scripts automatically. The system administrators must decompress the files and run the installation script manually whenever they will install plugins.

One can read our Guide to WHM Plugins – Installation Scripts documentation to gather information on Bash installation script.

Add an Optional Uninstallation Script

While providing an uninstallation script, one must be sure of removing the plugin’s icon, files, and directories, and then unregister the plugin with AppConfig.

  • One should not delete the plugin’s AppConfig configuration file before unregistering the plugin.
  • One can read our Guide to WHM Plugins – Uninstall Plugins documentation to gather more information on uninstallation script.

Add an Icon

Make sure that the installation script store your plugin’s icon in the /usr/local/cpanel/whostmgr/docroot/addon_plugins/ directory.

  • We strongly recommend using 48×48 .png images with a transparent background.
  • Make sure that the image files use a supported image file type (.gif, .jpeg, or .png).

Add Other Assets

  • A LICENSE file to provide license information for a plugin.
  • A README file to provide installation instructions, copyright and license information, and links to documentation and other external resources.

Register your Plugin with AppConfig.

  • One must certainly create an AppConfig configuration file and register the plugin with AppConfig in order to register.
  • One can read our Register a WHM Plugin with AppConfig tutorial to get an idea about the steps in registering a plugin.

Test your Plugin

You can run your plugin’s installation script and ensure the correct and proper plugin functions.

To get an idea about how to troubleshoot the common WHM plugin development issues, we recommend to read our Guide to Testing Custom Code documentation.

Conclusion

WHM plugin usages and ways of working are outlined vividly in this article.