Jump to content

Odd Custom Page Errors with 7.5


astewart

Recommended Posts

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 by astewart
Link to comment
Share on other sites

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

Guest
This topic is now closed to further replies.
×
×
  • 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