Jump to content

Client Area buttons and custom template


stroebs_za

Recommended Posts

Hi!

I'm somewhat of a newbie to WHMCS customisation and still figuring out how a few things work in v7.

I can find documentation on how to apply custom buttons (Actions sidebar) in the client area OR a custom template, but not both(?). The pre-built cPanel module seems to be able to do this but I cannot figure out how. My idea is to create a login button just like cPanel does for their Webmail, as well as a custom client area template for my server module.

 

Currently using:

function mymodule_ClientArea($params)
{
   // Determine the requested action and set service call parameters based on
   // the action.
   $requestedAction = isset($_REQUEST['customAction']) ? $_REQUEST['customAction'] : '';
   if ($requestedAction == 'manage') {
       $serviceAction = 'get_usage';
       $templateFile = 'templates/manage.tpl';
   } else {
       $serviceAction = 'get_stats';
       $templateFile = 'templates/overview.tpl';
   }
   try {
       // Call the service's function based on the request action, using the
       // values provided by WHMCS in `$params`.
       $response = array();

       return array(
           'tabOverviewReplacementTemplate' => $templateFile,
           'templateVariables' => array(),
       );
   } catch (Exception $e) {
       // Record the error in WHMCS's module log.
       logModuleCall(
           'provisioningmodule',
           __FUNCTION__,
           $params,
           $e->getMessage(),
           $e->getTraceAsString()
       );
       // In an error condition, display an error page.
       return array(
           'tabOverviewReplacementTemplate' => 'error.tpl',
           'templateVariables' => array(
               'usefulErrorHelper' => $e->getMessage(),
           ),
       );
   }
}

 

Link to comment
Share on other sites

  • WHMCS Developer

The cPanel module uses a template which outputs the custom buttons - check modules/servers/cpanel/templates/

In the clientArea function, we have the following (and only the following)

return array(
	'overrideDisplayTitle' => ucfirst($params['domain']),
	'tabOverviewReplacementTemplate' => 'overview.tpl',
	'tabOverviewModuleOutputTemplate' => 'loginbuttons.tpl',
);

This will load these two templates from the cpanel templates directory.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated