Working on the front lines, I have an opportunity to see how cPanel/WHM customizations are implemented in practice.  Often, I encounter novel ways of assembling our hooks and APIs to provide functionality.  However, there are times when I wonder if I saw this in the CodeSOD segment on a popular developer website that offers free stickers.

You want to automate or customize cPanel, what should you do?
Before beginning your project,  I recommend that you ask for guidance.  Our Developer Discussions forum is located at http://forums.cpanel.net/developer-discussions.html.  Here, you can learn from the experience of others who have written similar applications and apply their insight to your project.

However, we understand you may be bound by non-disclosure agreements (NDAs) and may not want to discuss your project publicly.  In such cases, you can contact our technical analysts by visiting http://tickets.cpanel.net/submit.

Talking to us for a few hours can save your team days or even weeks of development time.  We can pinpoint the exact documentation you need to reference to accomplish your task.  Utilizing our resources allow you to learn how to perform the task in a way that will work through many cPanel updates and upgrades.

Our staff understands the atmosphere of non-disclosure agreements and information sensitivity.  However, the more you can tell us about what you wish to accomplish (even in vague terms), the better we can assist you.  We love helping people and we strongly encourage you to come to us for assistance.

Branding cPanel software is not a complicated as many try to make it.
A common misconception that I often encounter is that you need to copy files, set immutable permissions, and maintain your own theme to use a customized cPanel interface.  Our Branding Editor and branding system are feature-rich and robust.  Our system allows you to do much more than change colors and swap logos.  You can even change some back-end code and significantly alter cPanel’s appearance.

By using our branding system rather than maintaining your own base code for a theme, updates to our software will not impact your customizations.  Additionally, any new functionality introduced by our software will automatically become available on your server and inherit your branding.

Maintaining custom theme code rather than using our branding system introduces many issues.  For example, with any newly introduced feature, you need to modify your code.  If code is optimized by cPanel, your code does not benefit from such changes.  If a function is dramatically improved, your custom code may break a feature.  Overall, it is a much better idea to use our custom branding system.

For those that have explored the Branding Editor but want more control over the cPanel branding system, our documentation team has assembled an Advanced Guide to Branding the cPanel Interface available at http://docs.cpanel.net/twiki/bin/view/AllDocumentation/WHMDocs/AdvancedBrandingGuide.

If you have already made a custom theme by the time you read this article, I recommend converting your changes to a custom style.  While this is more work upfront, you will save yourself days of troubleshooting later.

There’s an API for that
While it has become a bit of a cliché, if you can think of performing a task with cPanel or WHM, there is probably an API to handle it.  On many forums, I still battle the misconception that cPanel/WHM does not have APIs for creating accounts, manipulating items within a specific cPanel account, or APIs that can access remote cPanel/WHM servers.

If you do not know, please ask rather than assuming an API does not exist.  We have implemented many new APIs in the past few years, including the JSON API introduced in version 11.25.  The most popular venue for asking questions about our APIs is our Developer Discussions forum.  These forums are monitored by knowledgeable cPanel staff and frequented by developers who build applications that work with cPanel software.

In the field, I still come across many people that employ screen scraping (such as posting values to a page to trigger a result) and other crude methods of interacting with our software.  I recommend using our APIs rather than these easily broken methods.  By using our APIs, your software can continue to use the same code throughout many versions of cPanel/WHM, regardless of what usability or front-end changes occur in the software.  Screen scraping assumes our software is stagnant and will never change.  This is a poor assumption to make, especially given the recent redesign of cPanel’s mail page and the reorganization of WHM’s security functionality.  Such software improvements easily break screen scraping, but do not break scripts using our APIs.

Whoops?
If you currently employ any methods that I advised against in this article, do not worry.  Many people have made the migration towards using our APIs.  Feel welcome to search our Developer Discussions forum for similar scenarios so that you can better understand how to retrofit the code yourself.   If your situation is unique, feel welcome to start a new thread so that the community can assist you.

Using our APIs will help ensure your customizations can be used without issue for many cPanel versions.  By doing this now, you can curb potential support issues that may result from a new version of cPanel.

— Contributed by David Grega