Jump to content

Editing Sidebar Buttons


G. Brady

Recommended Posts

Good afternoon,

I'm trying to edit the CSS for the sidepanel in clientareahome.

I have two classes which override the theme's default classes in order to fix specific buttons that don't work in an area of WHMCS. An example of this is here on the left sidebar:
PBFWUXHhV3.thumb.png.9b3ad386b8c8e90bce863ea52aec114d.png

What I would like to do is add the css class btnw to the html classes of the first blue button under 'Your Info' to make the text become white, and add the css class btnd to the html classes of the second button under 'Contacts' to make the text black and more visible.

Do you have any information on how to do this? I can't find the code for the sidebar anywhere.

Many thanks,
G. Brady

Link to comment
Share on other sites

On 22/08/2020 at 16:39, G. Brady said:

I can't find the code for the sidebar anywhere.

technically, their creation occurs in the encrypted files, so you're never going to (legally) see the code. 🙈

On 22/08/2020 at 16:39, G. Brady said:

Do you have any information on how to do this?

I can think of about five ways to do this - but there's no point going through them all in detail as I suspect the simplest method, if you have a custom.css file (or equivalent), would be to use...

[menuitemname="Client Contacts"] a.btn {background-color: #000; color: white;}

VOysj9W.png

now going from that screenshot and question, your specific CSS changes will be slightly different, but because you can identify the specific sidebar by it's menuitemname, and as it only has one button, you can make specific changes to that button... obviously, if a sidebar has more than one button, there you would need be more specific with your class or ID selection.

alternatives would include changing css classes via a hook - either js or by altering the footer content of a sidebar (Example of both, certainly the latter, will have been posted previously)... and there should be a sidebar.tpl template in the /templates/*active template*/includes folder, but to edit that for this purpose would be supreme overkill (and extraordinarily messy!). 😲

however, for something like this, and because of the theme I know you're modifying, CSS might be the simplest way if you're already editing other CSS elements.

Link to comment
Share on other sites

5 hours ago, brian! said:

I can think of about five ways to do this - but there's no point going through them all in detail as I suspect the simplest method, if you have a custom.css file (or equivalent), would be to use...

I decided just to edit the classes the buttons already have. Luckily this didn't break any other buttons across WHMCS except one, so lucky escape haha.

I'm triny to create a hook to add a child to the "Account" drop down, which takes you to the items that are in your cart.

What I have so far is this:

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaSecondaryNavbar', 1, function (MenuItem $secondaryNavbar)
{
    $secondaryNavbar->getChild('Account') {
        $secondaryNavbar->getChild('Account')->addChild('View Cart')->setUri('#')->setOrder(6);
    }
});

Yet it doesn't show up in the drop down. Can you see what i've done wrong and how to go about fixing it? @brian! once again thanks for your help!

Link to comment
Share on other sites

13 hours ago, G. Brady said:

Can you see what i've done wrong and how to go about fixing it?

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaSecondaryNavbar', 1, function (MenuItem $secondaryNavbar) {
	
	$client = Menu::context('client');	
	if ($client && !is_null($secondaryNavbar->getChild('Account'))) {
            $secondaryNavbar->getChild('Account')->addChild(Lang::trans('viewcart'))->setUri('cart.php?a=view')->setOrder(6);
	}
});
13 hours ago, G. Brady said:

Also I would only like the 'View Cart' child to be only visible when a user is logged in.

included in the above hook. 🙂

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