Jump to content

Hide custom menu.


Recommended Posts

30 minutes ago, brian! said:

if you mean that "Quick Links" sidebar, can you post the hook code that you used to create the sidebar...

does it? i've never seen that sidebar before..

i'm sorry for miss understand hehe, i thing this issues is marketconect, but issues is sidebar  🤣

Link to comment
Share on other sites

we'll see if/when the OP replies!

there's only two menus on that screenshot - the sidebar, and the internal one within the weebly pages... it would make more sense if the sidebar was the problem because the store pages are normally full-width with no sidebars visible at all.

Link to comment
Share on other sites

Hello Bryan,
Below is the code I've used for the menu.
It is displayed while the client is logged in, but i want to hide it from the store page to take advantage of the full width pages.

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar)
{
	$client = Menu::context('client');
	if (!is_null($client)) {
	    
    $primarySidebar->addChild('quick-links', array(
        'label' => 'Quick Links',
        'uri' => '#',
        'icon' => 'fas fa-bars',
    ));

    $quickLinksPanel = $primarySidebar->getChild('quick-links');

    $quickLinksPanel->moveUp();

    $quickLinksPanel->addChild('dashboard-link', array(
        'uri' => '/clients/clientarea.php',
        'label' => 'Dashboard',
        'order' => 1,
        'icon' => 'fas fa-tachometer',
    ));

    $quickLinksPanel->addChild('services-link', array(
        'uri' => '/clients/clientarea.php?action=services',
        'label' => 'Services',
        'order' => 2,
        'icon' => 'fas fa-cube',
    ));

    $quickLinksPanel->addChild('my-domains-link', array(
        'uri' => '/clients/clientarea.php?action=domains',
        'label' => 'Domains',
        'order' => 3,
        'icon' => 'fas fa-globe',
    ));

    $quickLinksPanel->addChild('billing-link', array(
        'uri' => '/clients/clientarea.php?action=invoices',
        'label' => 'Billing',
        'order' => 4,
        'icon' => 'fas fa-credit-card',
    ));
	    $quickLinksPanel->addChild('email-history-link', array(
        'uri' => '/clients/clientarea.php?action=emails',
        'label' => 'Email History',
        'order' => 5,
        'icon' => 'fas fa-at',
    ));

    $quickLinksPanel->addChild('support-link', array(
        'uri' => '/clients/supporttickets.php',
        'label' => 'Support',
        'order' => 6,
        'icon' => 'fas fa-ticket-alt',
    ));
}

});

Thank you for your response

Link to comment
Share on other sites

Hi,

13 hours ago, nandin said:

It is displayed while the client is logged in, but i want to hide it from the store page to take advantage of the full width pages.

try the following code instead...

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar)
{
    GLOBAL $smarty;
    $templatefile = $smarty->getVariable('templatefile');
    $client = Menu::context('client');
    if (!is_null($client) && !strstr($templatefile, 'store/')) {

    $primarySidebar->addChild('quick-links', array(
        'label' => 'Quick Links',
        'icon' => 'fas fa-bars',
    ));
    $quickLinksPanel = $primarySidebar->getChild('quick-links');
    $quickLinksPanel->moveUp();
    $quickLinksPanel->addChild('dashboard-link', array(
        'uri' => 'clientarea.php',
        'label' => 'Dashboard',
        'order' => 1,
        'icon' => 'fas fa-tachometer',
    ));
    $quickLinksPanel->addChild('services-link', array(
        'uri' => 'clientarea.php?action=services',
        'label' => 'Services',
        'order' => 2,
        'icon' => 'fas fa-cube',
    ));
    $quickLinksPanel->addChild('my-domains-link', array(
        'uri' => 'clientarea.php?action=domains',
        'label' => 'Domains',
        'order' => 3,
        'icon' => 'fas fa-globe',
    ));
    $quickLinksPanel->addChild('billing-link', array(
        'uri' => 'clientarea.php?action=invoices',
        'label' => 'Billing',
        'order' => 4,
        'icon' => 'fas fa-credit-card',
    ));
    $quickLinksPanel->addChild('email-history-link', array(
        'uri' => 'clientarea.php?action=emails',
        'label' => 'Email History',
        'order' => 5,
        'icon' => 'fas fa-at',
    ));
    $quickLinksPanel->addChild('support-link', array(
        'uri' => 'supporttickets.php',
        'label' => 'Support',
        'order' => 6,
        'icon' => 'fas fa-ticket-alt',
    ));
}
});

... this sidebar should only appear for clients who are logged in and NOT viewing any MarketConnect store page. 🙂

Link to comment
Share on other sites

14 hours ago, nandin said:

Hello Bryan,
Below is the code I've used for the menu.
It is displayed while the client is logged in, but i want to hide it from the store page to take advantage of the full width pages.

this problem show in homepage and 404

i just add for homepage and page 404 original source from @brian! i like him to more advanced help us

original source

if (!is_null($client) && !strstr($templatefile, 'store/'))

add for homepage and 404

change to

if (!is_null($client) && !strstr($templatefile, 'store/') && !strstr($templatefile, 'homepage') && !strstr($templatefile, 'error'))

 

Link to comment
Share on other sites

55 minutes ago, lims said:

this problem show in homepage and 404

he didn't ask about other pages, only about the MarketConnect pages - 14th rule of fòrum replies is don't answer a question that wasn't asked! 🙂

56 minutes ago, lims said:

i just add for homepage and page 404 original source

to make it easier for updating, then you might use...

if (!is_null($client) && !in_array($templatefile,[strstr($templatefile,'store/'),strstr($templatefile,'error/'),'homepage'])) {

or if you can't use abbreviated arrays...

if (!is_null($client) && !in_array($templatefile,array(strstr($templatefile,'store/'),strstr($templatefile,'error/'),'homepage'))) {

... then if he ever needed to add another page that didn't require this sidebar, he could just add it to the list... either using strstr if there are multiple variants of the page (though off-hand I can't think of any), or just the templatename if he knows what it is.... e.g if we wanted to hide the sidebar from clientareahome...

if (!is_null($client) && !in_array($templatefile,array(strstr($templatefile,'store/'),strstr($templatefile,'error/'),'homepage','clientareahome'))) {
Link to comment
Share on other sites

On 3/25/2019 at 12:56 PM, brian! said:

Hi,

try the following code instead...


<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar)
{
    GLOBAL $smarty;
    $templatefile = $smarty->getVariable('templatefile');
    $client = Menu::context('client');
    if (!is_null($client) && !strstr($templatefile, 'store/')) {

    $primarySidebar->addChild('quick-links', array(
        'label' => 'Quick Links',
        'icon' => 'fas fa-bars',
    ));
    $quickLinksPanel = $primarySidebar->getChild('quick-links');
    $quickLinksPanel->moveUp();
    $quickLinksPanel->addChild('dashboard-link', array(
        'uri' => 'clientarea.php',
        'label' => 'Dashboard',
        'order' => 1,
        'icon' => 'fas fa-tachometer',
    ));
    $quickLinksPanel->addChild('services-link', array(
        'uri' => 'clientarea.php?action=services',
        'label' => 'Services',
        'order' => 2,
        'icon' => 'fas fa-cube',
    ));
    $quickLinksPanel->addChild('my-domains-link', array(
        'uri' => 'clientarea.php?action=domains',
        'label' => 'Domains',
        'order' => 3,
        'icon' => 'fas fa-globe',
    ));
    $quickLinksPanel->addChild('billing-link', array(
        'uri' => 'clientarea.php?action=invoices',
        'label' => 'Billing',
        'order' => 4,
        'icon' => 'fas fa-credit-card',
    ));
    $quickLinksPanel->addChild('email-history-link', array(
        'uri' => 'clientarea.php?action=emails',
        'label' => 'Email History',
        'order' => 5,
        'icon' => 'fas fa-at',
    ));
    $quickLinksPanel->addChild('support-link', array(
        'uri' => 'supporttickets.php',
        'label' => 'Support',
        'order' => 6,
        'icon' => 'fas fa-ticket-alt',
    ));
}
});

... this sidebar should only appear for clients who are logged in and NOT viewing any MarketConnect store page. 🙂

Brain!,

Your code works.

Thanks you for your help.
 

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