Jump to content

Custom Tabs (Client Area / Product Details) - Server Module


Fr3DBr

Recommended Posts

you should be able to add the Paypal tab by modifying the clientareaproductdetails.tpl template.

 

Is there any other way without touching the template ? Maybe via the server module itself, the same way I've added these buttons for Bandwidth Utilization and Power Management ?

Link to comment
Share on other sites

Is there any other way without touching the template ? Maybe via the server module itself, the same way I've added these buttons for Bandwidth Utilization and Power Management ?

I wouldn't have thought so - I assume your module is just modifying {$moduleclientarea} and outputting via that method...

 

I think you'd have to modify the template to add the new tab in the first place - after that, you may be able to determine whether it's shown or not (and it's content) by a module.

i'm sure if that's incorrect, someone will correct me! :idea:

Link to comment
Share on other sites

I wouldn't have thought so - I assume your module is just modifying {$moduleclientarea} and outputting via that method...

 

I think you'd have to modify the template to add the new tab in the first place - after that, you may be able to determine whether it's shown or not (and it's content) by a module.

i'm sure if that's incorrect, someone will correct me! :idea:

 

I've found this in whmcs repository:

 

/**
* Client area output logic handling.
*
* This function is used to define module specific client area output. It should
* return an array consisting of a template file and optional additional
* template variables to make available to that template.
*
* The template file you return can be one of two types:
*
* * tabOverviewModuleOutputTemplate - The output of the template provided here
*   will be displayed as part of the default product/service client area
*   product overview page.
*
* * tabOverviewReplacementTemplate - Alternatively using this option allows you
*   to entirely take control of the product/service overview page within the
*   client area.
*
* Whichever option you choose, extra template variables are defined in the same
* way. This demonstrates the use of the full replacement.
*
* Please Note: Using tabOverviewReplacementTemplate means you should display
* the standard information such as pricing and billing details in your custom
* template or they will not be visible to the end user.
*
* @param array $params common module parameters
*
* @see http://docs.whmcs.com/Provisioning_Module_SDK_Parameters
*
* @return array
*/
function provisioningmodule_ClientArea(array $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();
       $extraVariable1 = 'abc';
       $extraVariable2 = '123';
       return array(
           'tabOverviewReplacementTemplate' => $templateFile,
           'templateVariables' => array(
               'extraVariable1' => $extraVariable1,
               'extraVariable2' => $extraVariable2,
           ),
       );
   } 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(),
           ),
       );
   }
}

 

But not sure if this is what I'm looking for, I think with this piece of code, I can add information into 'existing tabs', but not sure if I can add extra ones. :)

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