user3589348
user3589348

Reputation: 1

WHMCS and writing a module

I’m trying to write a module for WHMCS and have a question.

When i use rapi_output function and put my codes there everything is ok and the result shown in admin area but when i try to put the code in rapi_clientarea nothing happened in the clientarea.

The written module exists here: modules/addons. I also put my codes in modules/servers and create product for client but not work clientarea function:

 {
 function Rapi_ClientArea($params) {
      $code = '
      <form action="" method="post" >
            <input type="submit" value="Login to Control PanelA" />
       </form>';

      return $code;

 }
 }

Upvotes: 0

Views: 2486

Answers (1)

wesamly
wesamly

Reputation: 1584

use the following code:

function Rapi_clientarea($vars) {

    $modulelink = $vars['modulelink'];
    $version = $vars['version'];
    $option1 = $vars['option1'];
    $option2 = $vars['option2'];
    $option3 = $vars['option3'];
    $option4 = $vars['option4'];
    $option5 = $vars['option5'];
    $option6 = $vars['option6'];
    $LANG = $vars['_lang'];

    return array(
        'pagetitle' => 'Addon Module',
        'breadcrumb' => array('index.php?m=demo'=>'Demo Addon'),
        'templatefile' => 'clienthome',
        'requirelogin' => true, # or false
        'vars' => array(
            'testvar' => 'demo',
            'anothervar' => 'value',
            'sample' => 'test',
        ),
    );

}

add your client area code to clienthome.tpl in your module folder, then access that page using the url: http://yourwhmcsurl.com/index.php?m=Rapi

More can be found in the official docs: http://docs.whmcs.com/Addon_Modules

Upvotes: 1

Related Questions