heapmaster Posted June 19, 2020 Share Posted June 19, 2020 I updated to PHP 7.1 and im getting the following error: [Wed Jun 17 09:12:52 2020] [notice] [client 1.2.3.4] [host abc.com] Backend log: [WHMCS Application] ERROR: ArgumentCountError: Too few arguments to function WHMCS\View\Client\Menu\MenuRepository::addContext(), 0 passed in /var/www/vhtdocs/usersite/html/vendor/illuminate/support/Facades/Facade.php on line 215 and exactly 2 expected in /var/www/vhtdocs/usersite/html/vendor/whmcs/whmcs-foundation/lib/View/Client/Menu/MenuRepository.php:0 Stack trace: #0 /var/www/vhtdocs/usersite/html/vendor/illuminate/support/Facades/Facade.php(215): WHMCS\View\Client\Menu\MenuRepository->addContext() #1 /var/www/vhtdocs/usersite/html/domaindns.php(866): Illuminate\Support\Facades\Facade::__callStatic('addContext', Array) #2 {main} {"exception":"[object] (ArgumentCountError(code: 0): Too few arguments to function WHMCS\\View\\Client\\Menu\\MenuRepository::addContext(), 0 passed in /var/www/vhtdocs/usersite/html/vendor/illuminate/support/Facades/Facade.php on line 215 and exactly 2 expected at /var/www/vhtdocs/usersite/html/vendor/whmcs/whmcs-foundation/lib/View/Client/Menu/MenuRepository.php:0)"} []\n, referer: https://www.abc.com/clientarea.php?action=domaindetails&id=1234 My code is: Menu::addContext(); Menu::primarySidebar('domainView'); And this was working but not is not. Can I get a sample of how to do this as per your docs and this page https://whmcs.community/topic/286293-error-too-few-arguments-passed-menurepositoryaddcontext/ the addContext is suppose to have two arguments passed to it, but your example here does not:https://developers.whmcs.com/advanced/creating-pages/ I realize it should be something like: Menu::addContext('client', ??????); Menu::addContext('domain', ?????); Menu::primarySidebar('domainView'); But the second arguments for addContext is what I dont know how to do and your docs dont have examples. I want to update my code so I can show the domainView sidebar page like it does within whmcs on the domains management page. Please help! 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Dan Posted June 21, 2020 Share Posted June 21, 2020 Hello, This is documented here which may help understand how the context is set: https://docs.whmcs.com/Editing_Client_Area_Menus#Context -2 Quote Link to comment Share on other sites More sharing options...
heapmaster Posted June 21, 2020 Author Share Posted June 21, 2020 (edited) 2 minutes ago, WHMCS Dan said: Hello, This is documented here which may help understand how the context is set: https://docs.whmcs.com/Editing_Client_Area_Menus#Context Ya I saw that and it doesnt help, hence me posting on here. Edited June 21, 2020 by heapmaster 0 Quote Link to comment Share on other sites More sharing options...
heapmaster Posted June 21, 2020 Author Share Posted June 21, 2020 Something like this would have been helpful.. https://github.com/WHMCS/developer-docs/issues/22 I figured it out via that link.. $currentUser = Client::find($_SESSION['uid']); $currentDomain = Domain::find($_GET["id"]); Menu::addContext('client', $currentUser); Menu::addContext('domain', $currentDomain); Menu::primarySidebar('domainView'); Now to get the default WHMCS secondary Domain Action Bar to show up... Menu::secondarySidebar('domainAction'); Errors out: Backend log: [WHMCS Application] ERROR: WHMCS\\Exception: Unknown sidebar "domainAction". in /vendor/whmcs/whmcs-foundation/lib/View/Client/Menu/MenuRepository.php:0 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Dan Posted June 21, 2020 Share Posted June 21, 2020 Can you perhaps clarify what is unclear in the documentation? The addContext is used to set the context of the menu, so for example for a client menu it would be: Menu::addContext('client', Client::find($_SESSION['uid'])); 0 Quote Link to comment Share on other sites More sharing options...
heapmaster Posted June 21, 2020 Author Share Posted June 21, 2020 8 minutes ago, WHMCS Dan said: Can you perhaps clarify what is unclear in the documentation? The addContext is used to set the context of the menu, so for example for a client menu it would be: Menu::addContext('client', Client::find($_SESSION['uid'])); This part was unclear: Client::find($_SESSION['uid']) ..... how to use WHMCS Classes correctly since your doc is all wrong here: https://developers.whmcs.com/advanced/creating-pages/ 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.