Jacobs "Blog"

Create a custom WHMCS with Six theme

I have no other way to do this but to base it off the six theme because their system is so undocumented it's fucking embarressing.

WHMCS is the go-to for small and medium web hosts looking to bill their clients for their services. It's also the go-to for people looking to resell other services such as SSL and domains. It's literally the undisputed heavy weight for web hosts out there. So why does it have to be such a piece of shit?

If you're like me and you're wondering how you just update and edit the Six theme, then let me explain. I assume you understand Smarty which is stupidly easy to work with. I'm yet to master /store/ pages.

Creating the custom php file

Create your custom php file. I created test.php in the root directory of whmcs.

$ cat test.php 
<?php
use WHMCS\ClientArea;
define('CLIENTAREA', true);
require __DIR__ . '/init.php';
$ca = new ClientArea();
$ca->initPage();
$ca->setTemplate('brian');
$ca->output();

Then I created a template for test.

$ cat templates/six/test.tpl 
<h3>Custom Page Yo!</h3>
<p>This is a custom page.</p>

Seems too simple to be true? Well it is. You'll notice if you do this in your Six theme then you'll get a page with a "horizontal rule" at the top. If you want to set a page title you can follow the horrible WHMCS documentation but if you want to be in-charge of your web page, then you need to edit the following file like so:

$ cat templates/six/includes/pageheader.tpl 
{if $pagetitle}
<div class="header-lined">
    <h1>{$title}{if $desc} <small>{$desc}</small>{/if}</h1>
    {if $showbreadcrumb}{include file="$template/includes/breadcrumb.tpl"}{/if}
</div>
{/if}

The addition of if $pagetitle means it will only show the horrible breadcrumbs if you decide to put it in. This way nothing else in whmcs is broken however you can control your pages.

So... you're welcome. WHMCS call me if you want to pay me a ridiculous sum of money to make your product half decent.