Jump to content

Using Hooks In WHMCS V5 & 6


swartjie

Recommended Posts

Hi,

 

I have a Hook file that I developed using WHMCS V6 as the testing platform, it works perfectly on 6, but on 5 it throws my entire admin area and WHMCS installation offline.

Basically causes the whole WHMCS to crash.

 

I followed the guide here http://docs.whmcs.com/Hooks:ClientAreaPrimaryNavbar and copied & paisted the code over as is to see if I made a mistake, but it keeps giving me the below error:

 

Catchable fatal error: Object of class Closure could not be converted to string in /home/mydomain/public_html/whmcs/includes/hookfunctions.php on line 0

 

What could be the cause of this?

 

Code Example:

add_hook(

'ClientAreaPrimaryNavbar',

1,

function($primaryNavbar)

{

/** @var \WHMCS\View\Menu\Item $primaryNavbar */

$newMenu = $primaryNavbar->addChild(

'uniqueMenuItemName',

array(

'name' => 'Home',

'label' => Lang::trans('languageStringVariable'),

'uri' => 'clientarea.php',

'order' => 99,

'icon' => 'fa-calendar-o',

)

);

$newMenu->addChild(

'uniqueSubMenuItemName',

array(

'name' => 'Item Name 1',

'label' => Lang::trans('languageStringVariable'),

'uri' => 'cart.php',

'order' => 10,

'icon' => 'fa-cart-plus',

)

);

}

);

Link to comment
Share on other sites

I don't think thats possible. WHMCS V6 totally re-worked the menu bar. WHMCS V5's menubar was a simple .tpl file, where V6 is now controlled by hooks.

 

This is true, V5 was very basic, a simple and static Bootstrap menu. For better or for worse in the Six template it's dynamic and uses hooks.

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.

×
×
  • 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