Extend and Overwrite Client Area Output

Please read this guide first before you start.

WHMCMS handle client area pages separately from WHMCS, in other words the variables passed to WHMCMS template is different (more or less) from variables passed to WHMCS templates, WHMCMS offer two different methods to access and override these variables using WHMCS Action Hooks.

First method is to override and/or extend WHMCMS variables before it get passed to Smarty template and displayed, using Action Hooks Point "WHMCMS_ClientAreaPage", the variables available in this function is different based on what section of WHMCMS you're browsing:

Create new Action Hook file inside /includes/hooks/ directory:

<?php

add_hook("WHMCMS_ClientAreaPage", 1, function($vars){

    $pageTitle = $vars["title"] . " Edited By Action Hook Function";

    return array(
        "title" => $pageTitle,
        "extra1" => "Extra Variable 1",
        "extra2" => "Extra Variable 2",
        "extra3" => "Extra Variable 3"
    );

});

?>


Second Method mainly used to access WHMCMS variables, you may try to overwrite their values but this will not work, if you need to overwrite WHMCMS variables use the first method;

Only the following Action Hook Points work with this method (ClientAreaPage, ClientAreaHeadOutput, ClientAreaHeaderOutput, ClientAreaFooterOutput):

<?php

add_hook("ClientAreaHeadOutput", 1, function($vars){

    if ($vars['whmcms']['projectid'] === 1){
        return array('<script>alert("Hello World!");</script>');
    }
});
?>

  • extend, templates, customization, overwrite
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Install WHMCMS

1) Downloading WHMCMS To download the latest version of WHMCMS login in our client area then...

Upgrade WHMCMS

This guide inteded for upgrades from v3.0.0 to higher version, if you need to upgrade from v2.x.x...

Upgrade from v2.x to v3.x

This guide inteded for upgrades from v2.x to v3.x, if you need to upgrade from v3.x to higher...

Template Integration

For all the contents created by WHMCMS to be displayed in client area, a simple template...

Menu Integration

Replacing WHMCS built-in navbars is a simple task in WHMCMS, in this tutorial I will show you how...