astewart Posted April 11, 2018 Share Posted April 11, 2018 (edited) Hey guys, I just recently upgraded to WHMCS 7.5 and on PHP 7.2 now. So far, it looks like all my custom pages are throwing the following error: ArgumentCountError: Too few arguments to function WHMCS\View\Client\Menu\MenuRepository::addContext(), 0 passed in /home/myuser/public_html/vendor/illuminate/support/Facades/Facade.php on line 215 and exactly 2 expected in /home/myuser/public_html/vendor/whmcs/whmcs-foundation/lib/View/Client/Menu/MenuRepository.php:0 Stack trace: #0 /home/myuser/public_html/vendor/illuminate/support/Facades/Facade.php(215): WHMCS\View\Client\Menu\MenuRepository->addContext() #1 /home/myuser/public_html/custompage.php(55): Illuminate\Support\Facades\Facade::__callStatic('addContext', Array) #2 {main} Here is what that custom page looks like: <?php use WHMCS\ClientArea; #use Illuminate\Database\Capsule\Manager as Capsule; use WHMCS\Database\Capsule; define('CLIENTAREA', true); define('FORCESSL', true); // Uncomment to force the page to use https:// require __DIR__ . '/init.php'; $ca = new ClientArea(); $ca->setPageTitle('My Custom Page'); $ca->addToBreadCrumb('index.php', Lang::trans('globalsystemname')); $ca->addToBreadCrumb('custompage.php', 'Custom Page'); $ca->initPage(); // Check login status if ($ca->isLoggedIn()) { /** * User is logged in - put any code you like here * * Here's an example to get the currently logged in clients first name */ $clientName = Capsule::table('tblclients') ->where('id', '=', $ca->getUserID())->pluck('firstname'); // 'pluck' was renamed within WHMCS 7.0. Replace it with 'value' instead. // ->where('id', '=', $ca->getUserID())->value('firstname'); $ca->assign('clientname', $clientName); } else { // User is not logged in $ca->assign('clientname', 'Random User'); } Menu::addContext(); #Menu::primarySidebar('announcementList'); Menu::secondarySidebar('announcementList'); # Define the template filename to be used without the .tpl extension $ca->setTemplate('pages/custompage'); $ca->output(); ?> Anyone see what the problem might be here? I didn't notice an update to the "Custom Pages" DEV page on how to create one. Anyone else experiencing this issue? Thanks! Edited April 11, 2018 by astewart Link to comment Share on other sites More sharing options...
brian! Posted April 11, 2018 Share Posted April 11, 2018 1 Link to comment Share on other sites More sharing options...
astewart Posted April 11, 2018 Author Share Posted April 11, 2018 Thanks Brian. I took a look through the first two pages here but I didn't see anything that was related, probably because I'm an idiot for not using the search. That worked like a Charm. Please feel free to remove this post since there is already another one covering this. Thanks again. Link to comment Share on other sites More sharing options...
Recommended Posts