Jump to content

Sidenav showing on email verification stage


Vike

Recommended Posts

Hello, I made a clietarea secondary sidebar using the following hook that only slows on the clientarea 'My Dahsboard' section

use WHMCS\View\Menu\Item as MenuItem;
add_hook('ClientAreaSecondarySidebar', 1, function (MenuItem $secondarySidebar)
{
    $client = Menu::context('client');
    if($client){
    $secondarySidebar->addChild('Resources')
        ->setUri('https://www.example.com/')
        ->setOrder(15);
    }
});
add_hook('ClientAreaSecondarySidebar', 1, function (MenuItem $secondarySidebar)
{
        if (!is_null($secondarySidebar->getChild('Resources'))) {
        $secondarySidebar->getChild('Resources')
            ->addChild('coming-soon')
                ->setLabel('Coming Soon...')
                ->setUri('clientarea.php')
                ->setOrder(100);
        }
});

But now having turned on WHMCS Email Verification - the sidebar shows on the stage where the user is required to enter their email and password while they are still logged into the clientarea. Is there a way to tell the hook to only show on the dashboard page?

Link to comment
Share on other sites

On 04/06/2019 at 08:24, mikejarvisnicol said:

Hello, I made a clietarea secondary sidebar using the following hook that only slows on the clientarea 'My Dahsboard' section

as written, it should show on every page in the client area once they're logged in...

On 04/06/2019 at 08:24, mikejarvisnicol said:

But now having turned on WHMCS Email Verification - the sidebar shows on the stage where the user is required to enter their email and password while they are still logged into the clientarea. Is there a way to tell the hook to only show on the dashboard page?

you could specify which templates/pages to show the sidebar on - e.g the hook below will only display your sidebar on the client's homepage - which i'm assuming is your dashboard page.

<?php

use WHMCS\View\Menu\Item as MenuItem;
add_hook('ClientAreaSecondarySidebar', 1, function (MenuItem $secondarySidebar)
{
	GLOBAL $smarty;
	$client = Menu::context('client');
	$templatefile = $smarty->getTemplateVars()['templatefile'];
	if($client && $templatefile === 'clientareahome'){
		$secondarySidebar->addChild('Resources')->setOrder(15)->addChild('coming-soon')->setLabel('Coming Soon...')->setUri('clientarea.php');
	}
});
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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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