Jump to content

How to: remove "View Available Addons" from client menus


Recommended Posts

On 08/05/2020 at 05:50, Ron the Web Guy said:

How do I remove "View Available Addons" from the client menus?

two options (at least when using Six) - you can either remove them using action hooks....

... or you can hide them with CSS (added to css/custom.css in your active template folder)...

#Primary_Navbar-Services-View_Available_Addons,
#Secondary_Sidebar-My_Services_Actions-View_Available_Addons {display:none;}
Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
3 hours ago, Ron the Web Guy said:

Does the CSS get overwritten during an update?

sadly, yes - if you haven't renamed/duplicated the six template folder, then during an update, those template/css files get overwritten.... including custom.css which makes no sense for WHMCS to overwrite with a blank file - that's been discussed here many times over the years, but they don't see it as a problem...

you'll need to check your templates too, as any changes you might have made to them pre-update, might also have been undone.... hooks should be unaffected, but always worth checking that they still work as expected.

if you were using the automatic updater, then it should have warned you that you were about to overwrite modified files and suggested taking a copy - generally speaking, it's always good to take a copy of the files and database before running any update - just in case things go wrong.

if you wanted to remove those two items using a hook, a quick way would be...

<?php 

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar){
	if (!is_null($primaryNavbar->getChild('Services'))) {
		$primaryNavbar->getChild('Services')->removeChild('View Available Addons');
	}
});

add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar){
	if (!is_null($secondarySidebar->getChild('My Services Actions'))) {
		$secondarySidebar->getChild('My Services Actions')->removeChild('View Available Addons');
	}
});
Link to comment
Share on other sites

14 hours ago, Ron the Web Guy said:

So: I just removed the custom css and created a new hook with your code and it works perfectly. THANKS! 🙂

if you had/wanted to, you could use a hook to add a link to a custom renamed custom.css file that WHMCS wouldn't touch/overwrite during an update.

14 hours ago, Ron the Web Guy said:

I will back up my hooks folder after each change... just in case. 😉

it's probably best to backup BEFORE you make any change, rather than after it! 🙂

as I said, the hooks folder should be safe from WHMCS interference... the css and templates are another matter.

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